diff --git a/README.md b/README.md index b63f431d8..3edfe48d4 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ EVCC is an extensible EV Charge Controller with PV integration implemented in [G ## Features - simple and clean user interface -- multiple [chargers](#charger): Wallbe (tested with Wallbe Eco S), Phoenix controllers (EV-CC-AC1-M3-CBC-RCM), go-eCharger, openWB slave, Mobile Charger Connect (currently used by Porsche), any other charger using scripting +- multiple [chargers](#charger): Wallbe (tested with Wallbe Eco S), Phoenix controllers (EM-CP-PP-ETH), go-eCharger, openWB slave, Mobile Charger Connect (currently used by Porsche), any other charger using scripting - more chargers experimentally supported: NRGKick, SimpleEVSE, EVSEWifi - different [vehicles](#vehicle) to show battery status: Audi (eTron), BMW (i3), Tesla, Nissan (Leaf), any other vehicle using scripting - [plugins](#plugins) for integrating with hardware devices and home automation: Modbus (meters and grid inverters), MQTT and shell scripts @@ -128,8 +128,8 @@ Optionally, charger can also provide: Available charger implementations are: -- `wallbe`: Wallbe Eco chargers (see [Hardware Preparation](#Wallbe-hardware-preparation) for preparing the Wallbe) -- `phoenix`: chargers with Phoenix controllers +- `wallbe`: Wallbe Eco chargers (see [Hardware Preparation](#Wallbe-hardware-preparation) for preparing the Wallbe). For older Wallbe boxes (pre 2019) with Phoenix EV-CC-AC1-M3-CBC-RCM-ETH controllers make sure to set `legacy: true` to enable correct current configuration. +- `phoenix`: chargers with Phoenix EM-CP-PP-ETH controllers - `simpleevse`: chargers with SimpleEVSE controllers connected via ModBus (e.g. OpenWB) - `evsewifi`: chargers with SimpleEVSE controllers using [SimpleEVSE-Wifi](https://github.com/CurtRod/SimpleEVSE-WiFi) - `nrgkick`: NRGKick chargers with Connect module @@ -147,7 +147,7 @@ To allow controlling charge start/stop, the Wallbe physical configuration must b More information on interacting with Wallbe chargers can be found at [GoingElectric](https://www.goingelectric.de/forum/viewtopic.php?p=1212583). Use with care. -**NOTE:** The Wallbe products come in two flavors. Older models (2017 known to be "old", 2019 known to be "new") use the Phoenix EV-CC-AC1-M3-CBC-RCM controller. For such models make sure to use `phoenix` charger type instead of `wallbe`. You can find you which one you have using [MBMD](5): +**NOTE:** The Wallbe products come in two flavors. Older models (2017 known to be "old", 2019 known to be "new") use the Phoenix EV-CC-AC1-M3-CBC-RCM controller. For such models make sure to set `legacy: true`. You can find you which one you have using [MBMD](5): ```sh mbmd read -a 192.168.0.8:502 -d 255 -t holding -e int 300 1 diff --git a/charger/phoenix.go b/charger/phoenix.go index 304399dab..dc44d8dfe 100644 --- a/charger/phoenix.go +++ b/charger/phoenix.go @@ -15,7 +15,7 @@ const ( phRegEnable = 400 // Coil ) -// Phoenix is an api.ChargeController implementation for Phoenix wallboxes. +// Phoenix is an api.ChargeController implementation for Phoenix EM-CP-PP-ETH wallboxes. // It uses Modbus TCP to communicate with the wallbox at modbus client id 255. type Phoenix struct { log *api.Logger diff --git a/charger/wallbe.go b/charger/wallbe.go index e96b5d419..bfd3fddd8 100644 --- a/charger/wallbe.go +++ b/charger/wallbe.go @@ -12,36 +12,46 @@ import ( const ( slaveID = 255 - wbRegStatus = 100 // Input - wbRegChargeTime = 102 // Input - wbRegActualCurrent = 300 // Holding - wbRegEnable = 400 // Coil - wbRegOverchargeProtect = 409 // Coil - wbRegReset = 413 // Coil - wbRegMaxCurrent = 528 // Holding + wbRegStatus = 100 // Input + wbRegChargeTime = 102 // Input + wbRegActualCurrent = 300 // Holding + wbRegEnable = 400 // Coil + wbRegMaxCurrent = 528 // Holding timeout = 1 * time.Second protocolTimeout = 2 * time.Second ) // Wallbe is an api.ChargeController implementation for Wallbe wallboxes. +// It supports both wallbe controllers (post 2019 models) and older ones using the +// Phoenix EV-CC-AC1-M3-CBC-RCM-ETH controller. // It uses Modbus TCP to communicate with the wallbox at modbus client id 255. type Wallbe struct { log *api.Logger client modbus.Client handler *modbus.TCPClientHandler + factor int64 } // NewWallbeFromConfig creates a Wallbe charger from generic config -func NewWallbeFromConfig(log *api.Logger, other map[string]interface{}) api.Charger { - cc := struct{ URI string }{} +func NewWallbeFromConfig(log *api.Logger, other map[string]interface{}) *Wallbe { + cc := struct { + URI string + Legacy bool + }{} api.DecodeOther(log, other, &cc) - return NewWallbe(cc.URI) + wb := NewWallbe(cc.URI) + + if cc.Legacy { + wb.factor = 1 + } + + return wb } // NewWallbe creates a Wallbe charger -func NewWallbe(conn string) api.Charger { +func NewWallbe(conn string) *Wallbe { if conn == "" { conn = "192.168.0.8:502" } @@ -57,6 +67,7 @@ func NewWallbe(conn string) api.Charger { log: api.NewLogger("wlbe"), client: client, handler: handler, + factor: 10, } // wb.showIOs() @@ -154,7 +165,7 @@ func (wb *Wallbe) MaxCurrent(current int64) error { return fmt.Errorf("invalid current %d", current) } - u := uint16(current * 10) + u := uint16(current * wb.factor) b, err := wb.client.WriteSingleRegister(wbRegMaxCurrent, u) wb.log.TRACE.Printf("write max current %d %0X: %0 X", wbRegMaxCurrent, u, b) diff --git a/charger/wallbe_test.go b/charger/wallbe_test.go new file mode 100644 index 000000000..7fd22f26b --- /dev/null +++ b/charger/wallbe_test.go @@ -0,0 +1,17 @@ +package charger + +import "testing" + +func TestWallbe(t *testing.T) { + wb := NewWallbeFromConfig(nil, nil) + + if wb.factor != 10 { + t.Errorf("invalid factor: %d", wb.factor) + } + + wb = NewWallbeFromConfig(nil, map[string]interface{}{"legacy": true}) + + if wb.factor != 1 { + t.Errorf("invalid factor: %d", wb.factor) + } +} diff --git a/evcc.dist.yaml b/evcc.dist.yaml index ee27ebd3a..fd9a3a209 100644 --- a/evcc.dist.yaml +++ b/evcc.dist.yaml @@ -66,6 +66,7 @@ chargers: - name: wallbe type: wallbe # Wallbe charger uri: 192.168.0.8:502 # ModBus address +# legacy: true # enable for older Wallbes with Phoenix EV-CC-AC1-M3-CBC-RCM controller - name: phoenix type: phoenix # Charger with Phoenix Contact controller uri: 192.168.0.8:502 # ModBus address