Fix prioritizer not using effective priority when balancing between loadpoints

This commit is contained in:
andig 2023-12-09 12:05:48 +01:00
parent 11467a5607
commit 8e7df670a8
2 changed files with 2 additions and 1 deletions

View file

@ -34,7 +34,7 @@ func (p *Prioritizer) GetChargePowerFlexibility(lp loadpoint.API) float64 {
)
for lp, power := range p.demand {
if lp.GetPriority() < prio {
if lp.EffectivePriority() < prio && power > 0 {
reduceBy += power
msg += fmt.Sprintf("%.0fW from %s at prio %d, ", power, lp.Title(), lp.EffectivePriority())
}

View file

@ -162,6 +162,7 @@ func (s *HTTPd) RegisterSiteHandlers(site site.API, cache *util.Cache) {
"remotedemand": {[]string{"POST", "OPTIONS"}, "/remotedemand/{demand:[a-z]+}/{source:[0-9a-zA-Z_-]+}", remoteDemandHandler(lp)},
"enableThreshold": {[]string{"POST", "OPTIONS"}, "/enable/threshold/{value:-?[0-9.]+}", floatHandler(pass(lp.SetEnableThreshold), lp.GetEnableThreshold)},
"disableThreshold": {[]string{"POST", "OPTIONS"}, "/disable/threshold/{value:-?[0-9.]+}", floatHandler(pass(lp.SetDisableThreshold), lp.GetDisableThreshold)},
// "priority": {[]string{"POST", "OPTIONS"}, "/priority/{value:[0-9.]+}", floatHandler(pass(lp.SetPriority), lp.GetPriority)},
}
for _, r := range routes {