Always publish status

This commit is contained in:
andig 2023-08-03 19:04:35 +02:00
parent 06c17c33ae
commit 1d34e01e8c

View file

@ -637,17 +637,16 @@ func (lp *Loadpoint) syncCharger() error {
return err
}
// in sync
if enabled == lp.enabled {
return nil
}
// out of sync
defer func() {
lp.enabled = enabled
lp.publish("enabled", lp.enabled)
}()
// in sync
if enabled == lp.enabled {
return nil
}
if enabled || lp.phaseSwitchCommandTimeoutElapsed() {
// ignore disabled state if vehicle was disconnected ^(lp.enabled && ^lp.connected)
if lp.guardGracePeriodElapsed() && lp.phaseSwitchCompleted() && (enabled || lp.connected()) {