From 8e7df670a883f6bc2f710ae0471514bd7413283b Mon Sep 17 00:00:00 2001 From: andig Date: Sat, 9 Dec 2023 12:05:48 +0100 Subject: [PATCH] Fix prioritizer not using effective priority when balancing between loadpoints --- core/prioritizer/prioritizer.go | 2 +- server/http.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/core/prioritizer/prioritizer.go b/core/prioritizer/prioritizer.go index 7681fe1c7..fe4480751 100644 --- a/core/prioritizer/prioritizer.go +++ b/core/prioritizer/prioritizer.go @@ -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()) } diff --git a/server/http.go b/server/http.go index ff26f7ee7..915504b2d 100644 --- a/server/http.go +++ b/server/http.go @@ -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 {