Closed snowball77 closed 1 year ago
I propose the following patch. It tries to read the modbus register. On failure it assumes the number of phases in the config is the one to use by not setting the phases variable.
===================================================================
diff --git a/charger/keba-modbus.go b/charger/keba-modbus.go
--- a/charger/keba-modbus.go (revision 97aef0cf7599d1ff37be47c3eb4067e8c4e85c17)
+++ b/charger/keba-modbus.go (date 1692404516032)
@@ -104,14 +104,12 @@
}
// phases
- b, err = wb.conn.ReadHoldingRegisters(kebaRegPhaseSource, 2)
- if err != nil {
- return nil, err
- }
-
var phases func(int) error
- if source := binary.BigEndian.Uint32(b); source == 3 {
- phases = wb.phases1p3p
+ b, err = wb.conn.ReadHoldingRegisters(kebaRegPhaseSource, 2)
+ if err == nil {
+ if source := binary.BigEndian.Uint32(b); source == 3 {
+ phases = wb.phases1p3p
+ }
}
// failsafe
Maybe a warning message could be added as well that defaults are used due to the inability to read the 1p3p feature from the box's modbus interface.
Could you create a PR for further discussion/solution for this? Thanks.
Describe the bug
I tried EVCC on my Solar Edge Home Charger wallbox which does not have a 1p3p switch and is connected to a SE hybrid inverter. I use the keba modbus template to integrate it.
However, EVCC does not start in this setting. The box fails on wb.conn.ReadHoldingRegisters(kebaRegPhaseSource, 2). I observed two types of failure. Either it says IllegalAccess or it says i/o timeout.
Steps to reproduce
Configuration details
Log details
What type of operating system are you running?
Linux
Version
evcc version 0.118.11