evcc: openWB: charger out of sync

Describe the bug

Messages “charger out of sync: expected disabled, got enabled” after evcc stops charge in pv mode.

I assume the reason is that the implementations of Enable() and Enabled() in openwb.go do not match:

func (m *OpenWB) Enable(enable bool) error {
	var current int64
	if enable {
		current = m.current
	}
	return m.currentS(current)
}

func (m *OpenWB) Enabled() (bool, error) {
	// current, err := m.enabledG()
	return m.current > 0, nil
}

Enable() setter never updates m.current but the getter queries m.current.

It seems either openWB should be queried for the actual currents or Enable() has to update m.current (old value is lost then):

func (m *OpenWB) Enable(enable bool) error {
	var current int64
	if enable {
		current = m.current
	} else {
		m.current = current
	}
	return m.currentS(current)
}

Or another state variable “enabled” is necessary to mirror openWB’s state.

Steps to reproduce

Use openWB and stop charging

Configuration details

openWB

Log details

Aug 17 17:40:11 evcc[3320281]: [lp-1 ] DEBUG 2022/08/17 17:40:11 charge power: 0W Aug 17 17:40:11 evcc[3320281]: [lp-2 ] DEBUG 2022/08/17 17:40:11 charge power: 0W Aug 17 17:40:11 evcc[3320281]: [lp-2 ] DEBUG 2022/08/17 17:40:11 charge currents: [0 0 0]A Aug 17 17:40:11 evcc[3320281]: [lp-2 ] DEBUG 2022/08/17 17:40:11 charger status: A Aug 17 17:40:12 evcc[3320281]: [openwb] TRACE 2022/08/17 17:40:12 recv openWB/system/Timestamp: ‘1660750812’ Aug 17 17:40:13 evcc[3320281]: [openwb] TRACE 2022/08/17 17:40:13 send openWB/set/isss/heartbeat: ‘1’ Aug 17 17:40:14 evcc[3320281]: [openwb] TRACE 2022/08/17 17:40:14 send openWB/set/isss/heartbeat: ‘1’ Aug 17 17:40:14 evcc[3320281]: [lp-1 ] DEBUG 2022/08/17 17:40:14 charge power: 0W Aug 17 17:40:14 evcc[3320281]: [lp-2 ] DEBUG 2022/08/17 17:40:14 charge power: 0W Aug 17 17:40:14 evcc[3320281]: [lp-1 ] DEBUG 2022/08/17 17:40:14 charge currents: [0 0 0]A Aug 17 17:40:14 evcc[3320281]: [lp-1 ] DEBUG 2022/08/17 17:40:14 charger status: B Aug 17 17:40:14 evcc[3320281]: [lp-1 ] WARN 2022/08/17 17:40:14 charger out of sync: expected disabled, got enabled Aug 17 17:40:14 evcc[3320281]: [openwb] TRACE 2022/08/17 17:40:14 send openWB/set/isss/Lp2Current: ‘0’ Aug 17 17:40:14 evcc[3320281]: [lp-1 ] DEBUG 2022/08/17 17:40:14 pv charge current: 0.556A = 0A + 0.556A (-128W @ 1p) Aug 17 17:40:14 evcc[3320281]: [lp-1 ] DEBUG 2022/08/17 17:40:14 climater active: false, target temp: 20.0°C, outside temp: 20.0°C

What type of operating system are you running?

Linux

Version

0.100

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18 (18 by maintainers)

Most upvoted comments

Das täuscht 😕

Hab nochmals darüber nachgedacht - Du hast zu 50% recht…

Ladestrom > 0 -> Charger ist enabled. Ladestrom == 0 -> Zustand unbekannt.

Also könnte man in Enabled() den Ladestrom mit currentsG prüfen, wenn dieser auf allen Phasen 0 ist kann man immer noch m.enabled zurückgeben.

Danke - kannte ich nicht.