Repository navigation
Add trip and charging advice with briefing charts - #25
Merged
Merged
Conversation
Learn consumption from saved trips, flag charging habits against a private home tariff, and summarize week, month, and year history with a local chart. Charge energy is the increase during a plug-in, and older rows that cannot match the battery change stay stored but drop out of totals.
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.
Weekly, monthly, and yearly briefings now summarize saved use and attach a local chart. Trip and charging advice stays on this computer, and a charge session stores only the energy added during that plug-in.
Trip advice
agentdrive advice trip <km>does not wake the car and does not change a setting. It uses a non-waking battery reading when the car is already online, otherwise the last saved snapshot. Consumption is battery percent per kilometre from the car's own trips. Fewer than three usable trips is reported as too little data. A saved outside temperature can add 10 or 20 percent in cold or hot weather. The same reply suggests an everyday charge limit, usually 80 percent, and a higher limit only before a long trip. If a departure schedule is set and it is cold or hot, it suggests preconditioning and does not start it.With only two usable trips:
Charging advice
agentdrive advice chargeflags often charging to 100% and leaving it, often starting below 20%, and often charging inside a saved peak window.agentdrive tariff set off-peak 22:00-06:00 --price 0.18andagentdrive tariff set peak 16:00-21:00store hours in$AGENTDRIVE_HOME/tariff.yaml. Price is optional. If the in-car timetable starts outside the cheap window, the reply says so and still requires the existing confirmation before anything changes.Briefings
Week, month, and year briefings add kilometres, trips, average km/day, charges, kWh added, average per charge, the previous period, and a coverage note. History is opportunistic, not continuous. Each of those briefings writes a PNG under the car directory in
AGENTDRIVE_HOMEand printsChart:.briefings/dashboard.htmlis one offline file with week, month, and year views. matplotlib is used when it is installed. Otherwise AgentDrive draws the PNG itself.Pass
--car <nickname>when several cars are saved. Advice, history, and the chart stay with that car.Charge energy
charge_energy_addedis the car's session counter, but the first reading of a new plug-in can still be the previous session, and some sessions keep climbing without returning to zero. The old code keptmax(), so 70% to 72% could be stored as 54.2 kWh, and 61% to 77% as 35.8 kWh when the counter had already reached 17.1 kWh. A new session now stores only the increase after a reset, or the rise above a high opening reading when that total cannot match the battery change. A normal session that climbs from about 0 to 5.0 kWh is still 5.0 kWh. Older rows are not rewritten. Summaries count a corrected figure when the samples support one, and leave out a saved figure that cannot match the percent change.Tests
pytestis green locally (226 tests), including too little trip data, trip sufficiency, charge-limit and tariff advice, habit flags, period comparison and coverage, the builtin PNG and offline HTML, the energy fix, and legacy rows left unchanged.