Add battery grid charging (#14855)

This commit is contained in:
andig 2024-08-03 15:23:50 +02:00 • committed by GitHub
parent bbf989c3c0
commit b0ea0582e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
37 changed files with 797 additions and 489 deletions

View file

@ -31,7 +31,7 @@ func (r Rates) Sort() {
// Current returns the rates current rate or error
func (r Rates) Current(now time.Time) (Rate, error) {
for _, rr := range r {
if (rr.Start.Before(now) || rr.Start.Equal(now)) && rr.End.After(now) {
if !rr.Start.After(now) && rr.End.After(now) {
return rr, nil
}
}