From 095fa42be98ba161bb74109c9fd7be891b196d82 Mon Sep 17 00:00:00 2001 From: Andreas Linde <42185+DerAndereAndi@users.noreply.github.com> Date: Sun, 1 Sep 2024 20:00:11 +0200 Subject: [PATCH] EEbus: only disable recommendations if available (#15829) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some EEBUS wallboxes like the PCMP do report the OSCEV usecase to be available, but it doesn’t provide the necessary recommendation limit data. This change adds checks for this case. --- charger/eebus.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/charger/eebus.go b/charger/eebus.go index d570d827f..dda77c191 100644 --- a/charger/eebus.go +++ b/charger/eebus.go @@ -343,8 +343,13 @@ func (c *EEBus) writeCurrentLimitData(evEntity spineapi.EntityRemoteInterface, c } // make sure the recommendations are inactive, otherwise the EV won't go to sleep - if err := c.disableLimits(evEntity, c.uc.OscEV); err != nil { - return err + // but only if it supports OSCEV and has required data! + if c.uc.OscEV.IsScenarioAvailableAtEntity(evEntity, 1) { + if _, err := c.uc.OscEV.LoadControlLimits(evEntity); err == nil { + if err := c.disableLimits(evEntity, c.uc.OscEV); err != nil { + return err + } + } } // set overload protection limits @@ -419,6 +424,11 @@ func (c *EEBus) writeLoadControlLimitsVASVW(evEntity spineapi.EntityRemoteInterf return false } + // OSCEV requires recommendation limits to be available + if _, err := c.uc.OscEV.LoadControlLimits(evEntity); err != nil { + return false + } + // on OSCEV all limits have to be active except they are set to the default value minLimits, _, _, err := c.uc.OscEV.CurrentLimits(evEntity) if err != nil {