From 67bf75de8e043c8bec95146e929c9a1fe9d32d72 Mon Sep 17 00:00:00 2001 From: andig Date: Wed, 17 Aug 2022 20:38:18 +0200 Subject: [PATCH] OpenWB: fix out of sync --- charger/openwb.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/charger/openwb.go b/charger/openwb.go index d0c1a0641..54e43e996 100644 --- a/charger/openwb.go +++ b/charger/openwb.go @@ -19,6 +19,7 @@ func init() { // OpenWB configures generic charger and charge meter for an openWB loadpoint type OpenWB struct { current int64 + enabled bool // enabledG func() (int64, error) statusG func() (string, error) currentS func(int64) error @@ -172,12 +173,14 @@ func (m *OpenWB) Enable(enable bool) error { current = m.current } + m.enabled = current > 0 + return m.currentS(current) } func (m *OpenWB) Enabled() (bool, error) { // current, err := m.enabledG() - return m.current > 0, nil + return m.enabled, nil } func (m *OpenWB) Status() (api.ChargeStatus, error) {