From 0d2407e12a292689471bcfcc80b5acd62c06404d Mon Sep 17 00:00:00 2001 From: Kiechlus Date: Tue, 23 Sep 2025 07:25:12 +0200 Subject: [PATCH] Metrics: align 15min profile aggregation with local time (#23779) Co-authored-by: Felix Kiechle --- core/metrics/db.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/metrics/db.go b/core/metrics/db.go index d1ddaeb55..8f3b3956d 100644 --- a/core/metrics/db.go +++ b/core/metrics/db.go @@ -36,11 +36,12 @@ func Profile(from time.Time) (*[96]float64, error) { return nil, err } + // Use 'localtime' in strftime to fix https://github.com/evcc-io/evcc/discussions/23759 rows, err := db.Query(`SELECT min(ts) AS ts, avg(val) AS val FROM meters WHERE meter = ? AND ts >= ? - GROUP BY strftime("%H:%M", ts) - ORDER BY strftime("%H:%M", ts) ASC`, 1, from, + GROUP BY strftime("%H:%M", ts, 'localtime') + ORDER BY strftime("%H:%M", ts, 'localtime') ASC`, 1, from, ) if err != nil { return nil, err