chore: minor

This commit is contained in:
andig 2026-08-11 09:54:34 +02:00
parent dc143a6dc7
commit 6fdb83fc14
10 changed files with 24 additions and 29 deletions

View file

@ -2,6 +2,7 @@ package prioritizer
import (
"fmt"
"strings"
"sync"
"github.com/evcc-io/evcc/api"
@ -35,18 +36,18 @@ func (p *Prioritizer) GetChargePowerFlexibility(lp loadpoint.API) float64 {
var (
reduceBy float64
msg string
msg strings.Builder
)
for lp, power := range p.demand {
if lp.EffectivePriority() < prio && power > 0 {
reduceBy += power
msg += fmt.Sprintf("%.0fW from %s at prio %d, ", power, lp.GetTitle(), lp.EffectivePriority())
msg.WriteString(fmt.Sprintf("%.0fW from %s at prio %d, ", power, lp.GetTitle(), lp.EffectivePriority()))
}
}
if p.log != nil && reduceBy > 0 {
p.log.DEBUG.Printf("lp %s at prio %d gets additional %stotal %.0fW\n", lp.GetTitle(), lp.EffectivePriority(), msg, reduceBy)
p.log.DEBUG.Printf("lp %s at prio %d gets additional %stotal %.0fW\n", lp.GetTitle(), lp.EffectivePriority(), msg.String(), reduceBy)
}
return reduceBy

View file

@ -26,11 +26,11 @@ func (s forecastSeries) MarshalBytes() ([]byte, error) {
}
type solarDetails struct {
Scale float64 `json:"scale"` // scale factor yield/forecasted today, 1 if unscaled
Today dailyDetails `json:"today,omitempty"` // tomorrow
Tomorrow dailyDetails `json:"tomorrow,omitempty"` // tomorrow
DayAfterTomorrow dailyDetails `json:"dayAfterTomorrow,omitempty"` // day after tomorrow
Timeseries timeseries `json:"timeseries,omitempty"` // timeseries of forecasted energy
Scale float64 `json:"scale"` // scale factor yield/forecasted today, 1 if unscaled
Today dailyDetails `json:"today"` // tomorrow
Tomorrow dailyDetails `json:"tomorrow"` // tomorrow
DayAfterTomorrow dailyDetails `json:"dayAfterTomorrow"` // day after tomorrow
Timeseries timeseries `json:"timeseries,omitempty"` // timeseries of forecasted energy
}
var _ api.BytesMarshaler = (*solarDetails)(nil)