Zaptec: ignore double-enable errors (#21594)
This commit is contained in:
parent
9ea6ed6d1c
commit
f6bb03bbb9
1 changed files with 8 additions and 4 deletions
|
|
@ -215,15 +215,19 @@ func (c *Zaptec) Enable(enable bool) error {
|
|||
}
|
||||
|
||||
uri := fmt.Sprintf("%s/api/chargers/%s/sendCommand/%d", zaptec.ApiURL, c.instance.Id, cmd)
|
||||
|
||||
req, _ := request.New(http.MethodPost, uri, nil, request.JSONEncoding)
|
||||
_, err := c.DoBody(req)
|
||||
if err == nil {
|
||||
|
||||
var res struct {
|
||||
Code int
|
||||
}
|
||||
|
||||
// ignore 528: Charging is not Paused nor Scheduled; Resume command cannot be sent
|
||||
if err := c.DoJSON(req, &res); err == nil || res.Code == 528 {
|
||||
c.enabled = enable
|
||||
c.statusG.Reset()
|
||||
}
|
||||
|
||||
return err
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Zaptec) chargerUpdate(data zaptec.Update) error {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue