From 69a009d686734b143708a90d007b0c8f6cf526a0 Mon Sep 17 00:00:00 2001 From: andig Date: Tue, 17 Nov 2020 08:16:18 +0100 Subject: [PATCH] Switch to go-e amx api (#442) --- README.md | 2 +- charger/go-e.go | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 2462ff41f..611730d84 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/charger/go-e.go b/charger/go-e.go index 5ceb4b6c2..c01117b8c 100644 --- a/charger/go-e.go +++ b/charger/go-e.go @@ -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