ADR-0082: The « Voitures » popup, « Charge » page¶
Page en anglais
Cette page n'existe qu'en anglais.
Status: Accepted (2026-11-10). Date: 2026-11-10
Context¶
ADR-0079 builds the « Voitures » popup with its first page, « Aperçu ». The author's plan for the cars adds three pages to it (Charge, Trajets, État). This one is lot 8, sketch C2 « Charge »: for each car, the hours it charged today, drawn on a 24-hour strip next to the sun the forecast promises, and a suggested window to charge on the sun. Both pieces of data are already on the tablet: ADR-0078 receives the 24 kWh per hour of each car (tab5_maj_voiture_jour), ADR-0058 the production forecast of every hour (tab5_maj_energie_soleil).
Decision¶
- No new service, no new field. The page reads the two actions above.
tab5-api-logic.yamlgets one more call in each (voitures_charge_jour(rang, debut, valeurs),voitures_charge_soleil(payload)), both parsed by the existingconso_jour_lire()/energie_soleil_lire(); the page keeps its own copies of the series (ConsoJourandEnergieSoleilLu, about 600 bytes) rather than reaching intotab5_energie.cpp, where lot 5 works. The contract (contrat/contrat.yaml) is unchanged. - A page of the popup, in new files.
Tab5/ecran/tab5_voitures_charge.{h,cpp}plus one row in the page tablekPagesoftab5_voitures.cpp(mechanism of the first commit of this lot: tabs, left / right swipe, ADR-0046). The widgets are created in C++ onvoitures_corps()at the first time the page is shown, with no YAML id; they are repainted by compare-before-write helpers and re-coloured from the palette at every paint (a theme switch repaints the popup). A page without data has no tab: it exists only when a car was received and at least one hour of today is known for it (a series of another day does not count: yesterday is never shown as today). Unknown hours stay empty (a0is a datum). - Tab5 only. The strip does not fit the body of the 7B (946 × 478): the page has no data there (
kChargePage), hence no tab and no widget, the same compromise as the stacked consumption of the Aujourd'hui page (ADR-0078). The 7B compiles and its popup stays what it was. - What the page draws. On top, one card per car with hours (side by side, full width for one): name in its rank colour, battery in large figures and in a bar, a tick at the limit the car reports, the part still to charge up to it (while charging), the state, and — charging — the arrival time worked out from the minutes the car itself announced when its last push arrived (
VoitureRecue::recue_le, the push instant), minus the time elapsed since — shown as a clock time only while it is still today, as a duration otherwise, and not at all once the announcement is past (an old push is never presented as an end of charge to come). In the middle, the 24-hour strip (rectangles only, no chart object): the sun forecast as golden bars scaled to the day's peak; one row per car whose green runs are the hours it received at least 0.1 kWh (plages_charge()); a vertical now mark with the time in a bubble; a green « Fin prévue » bar from now to now + the car's own minutes. At the bottom, the suggested window as a sentence and a golden frame on the strip. - The suggested window is pure and tested on a PC.
creneau_solaire(prevu, n, maintenant)inTab5/socle/tab5_creneau.h(header only, cases intools/test_tab5_socle.cpp, run by the CI jobpython): among the hours still to come, the run of consecutive hours whose forecast keeps 70 % of the day's peak; the strongest run (greatest sum, the earliest on a tie) if a cloud splits the day; none under a 0.5 kWh peak, with no forecast, with no value in an hour (an hour without a value is never inside a window), or when nothing is left after the peak. The current hour counts while less than half of it is over.en_courstells whether the window has started; the sentence then reads « jusqu'à N h » instead of « de N h à M h ». With no clock set (maintenant< 0) the whole day is considered. The firmware composes the sentence withtr(): the pure function returns numbers only. - A suggestion, never a fact. The screen says so every time: the grey note « Suggestion d'après la prévision du soleil » sits beside the sentence, and without any forecast the band says « Pas de prévision du soleil reçue » instead of guessing. The wording is « Créneau conseillé », never « le meilleur moment » or « il y aura du soleil ».
- Two rules, two places. Home Assistant already sends a « meilleur créneau » of three consecutive hours for the Aujourd'hui page (
creneau_debut/creneau_finoftab5_maj_energie_soleil,HomeAssistant_Config/packages/tab5_energie.yaml). The page of the cars does not use it: a car charging for two hours at 7 kW needs a window as long as the sun, so the rule is the share of the day's peak, computed on the tablet from the forecast it already has. The two can differ (three hours around the peak against every hour above 70 %); this is deliberate, and each screen names its own thing. To be looked at by the author. - Nothing is invented. The strip draws only what the data carries: no « plugged » hours (no series says when a car was plugged), no fake charging in the future (the run that contains the current hour is cut at the now mark, the hour being partial), the « fin prévue » comes from the car's own minutes, and the limit is the car's.
- Texts go through
tr()in the seven languages (eleven new keys + « Aperçu » from the first commit). The sun glyph of the band is inmdi_font_45and inMDI_CODE_TARGETS(glyphe_conseil, rule 9). Colours are palette roles only.
Consequences¶
- No car chosen, a car without hours of the day, a series of another day, or a 7B: the popup is what ADR-0079 built, one page and no tab. Every other screen of the off-device render is unchanged; only the new screens
voitures-charge-2,voitures-charge-1andvoitures-charge-sans-soleilare added. - Not judged on the real screen and not tested with a real car. The page was drawn from the demo's data (
tools/demo/scenarios.py:CONSO_JOUR,ENERGIE_SOLEIL) and checked in the off-device render; the author's eye on the tablet decides the density of the strip, the golden frame over the bars and the tab names. A real car's hours depend on the analysis script of ADR-0074: not verified on real data. - Cost not measured. About 110 LVGL objects (counted from the code, not from a run) are created at the first display of the page — the container, two cards of ten widgets, the strip (24 bars, per car a track, a « fin prévue » bar and up to twelve runs because a car can alternate an hour on and an hour off, 8 grid marks and 8 hour labels, the legend, the bubble) and the band — and kept: heap and PSRAM at run time were not measured (nothing was flashed), and the render does not tell either. Nothing is painted while the popup is closed or the page is hidden.
- Cases not handled. All the cars at their limit and the sun fully gone: the band says « Pas de créneau conseillé aujourd'hui », which is true of the sun, not of the cars' needs (the firmware does not know how much a car must still charge). The window is computed from the forecast of the day: after midnight and before the first push of the new day, the series of yesterday is refused and the page disappears until Home Assistant pushes again.
- The 24-hour strip is read at a glance but each hour is 42 px wide: a short charge (under half an hour in an hour) is drawn as a full hour, since the data is per hour.