From 46a28992e67748348070cd23cbafebd9bcab8087 Mon Sep 17 00:00:00 2001 From: andig Date: Thu, 11 Mar 2021 13:28:34 +0100 Subject: [PATCH] Disable remote control without configured vehicle (#745) --- hems/semp/semp.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hems/semp/semp.go b/hems/semp/semp.go index 9f43ae655..1632d0153 100644 --- a/hems/semp/semp.go +++ b/hems/semp/semp.go @@ -366,9 +366,14 @@ func (s *SEMP) deviceStatus(id int, lp core.LoadPointAPI) DeviceStatus { } } + var hasVehicle bool + if hasVehicleP, err := s.cache.GetChecked(id, "hasVehicle"); err == nil { + hasVehicle = hasVehicleP.Val.(bool) + } + res := DeviceStatus{ DeviceID: s.deviceID(id), - EMSignalsAccepted: s.controllable && isPV, + EMSignalsAccepted: s.controllable && isPV && hasVehicle, PowerInfo: PowerInfo{ AveragePower: int(chargePower), AveragingInterval: 60, @@ -433,7 +438,7 @@ func (s *SEMP) planningRequest(id int, lp core.LoadPointAPI) (res PlanningReques if mode == api.ModeNow { minPowerConsumption = maxPowerConsumption } - + if connected && maxEnergy > 0 { res = PlanningRequest{ Timeframe: []Timeframe{{