Check connected status (#673)

This commit is contained in:
premultiply 2021-02-23 15:44:03 +01:00 • committed by GitHub
parent ff7e3131e8
commit 87139edd5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -393,6 +393,11 @@ func (s *SEMP) planningRequest(id int, lp core.LoadPointAPI) (res PlanningReques
mode = modeP.Val.(api.ChargeMode)
}
var connected bool
if connectedP, err := s.cache.GetChecked(id, "connected"); err == nil {
connected = connectedP.Val.(bool)
}
var charging bool
if chargingP, err := s.cache.GetChecked(id, "charging"); err == nil {
charging = chargingP.Val.(bool)
@ -423,7 +428,7 @@ func (s *SEMP) planningRequest(id int, lp core.LoadPointAPI) (res PlanningReques
minEnergy = 0
}
if maxEnergy > 0 {
if connected && maxEnergy > 0 {
res = PlanningRequest{
Timeframe: []Timeframe{{
DeviceID: s.deviceID(id),