From b8563f2d4ab3185614049eaef6d8d862ae83e9bd Mon Sep 17 00:00:00 2001 From: Ingo <71161062+iseeberg79@users.noreply.github.com> Date: Wed, 4 Jun 2025 19:53:54 +0200 Subject: [PATCH] Loadpoint: always publish charge voltages (#21641) --- core/loadpoint.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/core/loadpoint.go b/core/loadpoint.go index 0db6ca419..93083228d 100644 --- a/core/loadpoint.go +++ b/core/loadpoint.go @@ -1559,10 +1559,6 @@ func (lp *Loadpoint) phasesFromChargeCurrents() { // updateChargeVoltages uses PhaseVoltages interface to count phases with nominal grid voltage func (lp *Loadpoint) updateChargeVoltages() { - if lp.hasPhaseSwitching() { - return // we don't need the voltages - } - phaseMeter, ok := lp.chargeMeter.(api.PhaseVoltages) if !ok { return // don't guess @@ -1570,7 +1566,10 @@ func (lp *Loadpoint) updateChargeVoltages() { u1, u2, u3, err := phaseMeter.Voltages() if err != nil { - lp.log.ERROR.Printf("charge voltages: %v", err) + // phaseSwitching devices may announce voltages but doesn't deliver + if !errors.Is(err, api.ErrNotAvailable) { + lp.log.ERROR.Printf("charge voltages: %v", err) + } return } @@ -1578,6 +1577,10 @@ func (lp *Loadpoint) updateChargeVoltages() { lp.log.DEBUG.Printf("charge voltages: %.3gV", chargeVoltages) lp.publish(keys.ChargeVoltages, chargeVoltages) + if lp.hasPhaseSwitching() { + return // we don't need the voltages, but publish + } + a1, a2, a3 := u1 >= minActiveVoltage, u2 >= minActiveVoltage, u3 >= minActiveVoltage // Quine-McCluskey for (¬L1∧L2∧¬L3) ∨ (L1∧L2∧¬L3) ∨ (¬L1∧¬L2∧L3) ∨ (L1∧¬L2∧L3) ∨ (¬L1∧L2∧L3) -> ¬L1 ∧ L3 ∨ L2 ∧ ¬L3 ∨ ¬L2 ∧ L3