Optimizer: fix panic in prorate on continuousDemand returning nil (#24996)

This commit is contained in:
RenatusRo 2025-11-03 16:09:11 +01:00 • committed by GitHub
parent 1c00a7d746
commit 8be195b341
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -200,7 +200,9 @@ func (site *Site) optimizerUpdate(battery []measurement) error {
case api.ModeNow, api.ModeMinPV:
// forced min/max charging
bat.PDemand = prorate(continuousDemand(lp, minLen), firstSlotDuration)
if demand := continuousDemand(lp, minLen); demand != nil {
bat.PDemand = prorate(demand, firstSlotDuration)
}
case api.ModePV:
// add plan goal