Switch to go-e amx api (#442)

This commit is contained in:
andig 2020-11-17 08:16:18 +01:00 • committed by GitHub
parent e619e174ed
commit 69a009d686
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View file

@ -156,7 +156,7 @@ In general, due to the minimum value of 5% for signalling the EV duty cycle, the
Charger is responsible for handling EV state and adjusting charge current. Available charger implementations are:
- `evsewifi`: chargers with SimpleEVSE controllers using [EVSE-WiFi](https://www.evse-wifi.de/)
- `go-e`: go-eCharger chargers (both local and cloud API are supported)
- `go-e`: go-eCharger chargers (both local and cloud API are supported, firmware 40.0 required)
- `keba`: KEBA KeContact P20/P30 and BMW chargers (see [Preparation](#keba-preparation))
- `mcc`: Mobile Charger Connect devices (Audi, Bentley, Porsche)
- `openWB`: openWB chargers using openWB's MQTT interface

View file

@ -28,7 +28,8 @@ type goeStatusResponse struct {
Fwv string `json:"fwv"` // firmware version - indicates local response
Car int `json:"car,string"` // car status
Alw int `json:"alw,string"` // allow charging
Amp int `json:"amp,string"` // current [A]
Amp int `json:"amp,string"` // current [A], goes to EEPROM
Amx int `json:"amx,string"` // current [A], doesn't go to EEPROM
Err int `json:"err,string"` // error
Stp int `json:"stp,string"` // stop state
Tmp int `json:"tmp,string"` // temperature [°C]
@ -193,7 +194,7 @@ func (c *GoE) Enable(enable bool) error {
status, err := c.apiUpdate(fmt.Sprintf("alw=%d", b))
if err == nil && isValid(status) && status.Alw != b {
return fmt.Errorf("alw update failed: %d", status.Amp)
return fmt.Errorf("alw update failed: %d", status.Alw)
}
return err
@ -201,9 +202,9 @@ func (c *GoE) Enable(enable bool) error {
// MaxCurrent implements the Charger.MaxCurrent interface
func (c *GoE) MaxCurrent(current int64) error {
status, err := c.apiUpdate(fmt.Sprintf("amp=%d", current))
if err == nil && isValid(status) && int64(status.Amp) != current {
return fmt.Errorf("amp update failed: %d", status.Amp)
status, err := c.apiUpdate(fmt.Sprintf("amx=%d", current))
if err == nil && isValid(status) && int64(status.Amx) != current {
return fmt.Errorf("amx update failed: %d", status.Amx)
}
return err