Repository navigation
Conversation
Preview build
|
6 tasks
joszz
force-pushed
the
fix/bev-day-counter
branch
from
November 4, 2026 20:42
5d9db3f to
1e69b2b
Compare
joszz
force-pushed
the
fix/bev-day-counter
branch
2 times, most recently
from
November 5, 2026 19:37
1e5a5e6 to
786e798
Compare
This was referenced Nov 7, 2026
joszz
force-pushed
the
fix/bev-day-counter
branch
from
November 8, 2026 17:57
786e798 to
7cc65a6
Compare
An MG ZS EV (issue #551) adds 33 to 35 kWh to drivetrain/powerUsageOfDay at some polls while parked, so a 4 km day read 134 kWh and 47040 Wh/km. Its powerUsageSinceLastCharge comes out of the same charge status message and matches the state of charge drop to the hundredth, so it is the reference. - DailyStatsBuilder compares the two counters per day: their rises within runs without a reset, and on a day without a charge the day total against what had left the battery since the last charge. DailyStat gains SinceChargeTotal (the day off the since-last-charge counter, starting from the last reading before the day) and CounterUnbacked. - utils/energy picks the figure: a plug-in day the API flags falls back to the since-last-charge total; a hybrid stays on its day counter. - The live kWh-today and Wh/km cards hide a day counter that holds more than left the battery since a charge that was not today. Refs #551 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
joszz
force-pushed
the
fix/bev-day-counter
branch
from
November 9, 2026 13:14
7cc65a6 to
057e1cd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #551 (not
Fixesuntil the reporter confirms on the car).What the telemetry shows
The reporter's
telemetry.csv(MG ZS EV Long Range, 2022) settles which of the two suspects in the issue it is. Neither:PowerUsageSinceLastChargewent from 8.86 to 11.12 kWh while the state of charge dropped from 53.8 % to 50.5 %: 2.26 kWh against 3.3 % of 68.3 kWh = 2.25 kWh.HvSocKwhdropped by the same 2.26. The gateway scales both counters with the same factor, so the scale is right too.PowerUsageOfDaygains 33 to 35 kWh at some polls while the car is parked and nothing else moves: 33.16, then 66.23 two minutes later, then 99.48, then 134.24 on a 4 km day. The next day it starts at 34.67 with 0 km driven. Small real rises (0.09 kWh steps while driving) sit on top of those jumps.The fix
The two counters come out of the same charge status message, so the since-last-charge counter is the reference for the day counter.
DailyStatsBuilder): per day, compare the counters' rises within runs where neither reset (a charge resets since-last-charge), and on a day without a charge compare the day total with what had left the battery since the last charge (factor 1.5 plus 1 kWh for regeneration and rounding).DailyStatgainssinceChargeTotal(the day off the since-last-charge counter, starting from the last reading before the day, so cached and uncached days agree) andcounterUnbacked.utils/energy):dailyCounterTotalusessinceChargeTotalfor a flagged day on a car that plugs in. A plain hybrid stays on its day counter, because its counters hold fuel and the check has never been validated against one. The daily usage chart, month table and level history dialog all read through it.todaysEnergyKwhhides the kWh-today and Wh/km values when the day counter holds more than left the battery since a charge that was more than 24 hours ago. The since-last-charge efficiency card is unchanged and keeps working.With the reporter's rows the chart reads 0.75 kWh on 2 Nov and 1.51 kWh on 3 Nov (0.85 kWh of it lost while parked overnight), instead of 134 and 141.
The widget API's
powerUsageOfDayKwhstill passes the raw counter through, as before.Tests
DailyEnergyCheckTestswith the reporter's 40 rows verbatim, plus a sound car, regeneration, a charge during the day, a single-poll day and a car without a since-last-charge counter. A repository test checks the seed from before the period.todaysEnergyKwh,dailyCounterTotal, and the card registry with the reporter's values.dotnet test: 1474 passed, 17 skipped (Postgres). Vitest: 1212 passed. vue-tsc, ESLint, oxlint anddotnet formatclean.No migrations.
🤖 Generated with Claude Code