Skip to content

ADR-0078: The consumption of the day, stacked, on the « Aujourd'hui » page of the Energy popup

Status: Proposed (2026-11-09; draft pull request, judged on the off-device render only — not on the real screen). Date: 2026-11-09

Context

Lot 4 of the author's plan for the electric cars (sketch B2). The « Aujourd'hui » page (ADR-0058) shows the sun's arc, the production hour by hour (solid bars), the forecast (outlined bars), the learned clear-sky curve and the best window; its right column gives the produced, forecast and tomorrow's energy. It shows no consumption at all (nothing in ADR-0058 nor in the code: the page reads the hours series of the production, the sun payload, and nothing else). The cars of ADR-0076 and the analysis of ADR-0074 make the question « did the cars charge from the sun? » answerable; this page is where it is answered for the day.

Decision

  • One service, shaped like the hours of the production. tab5_maj_voiture_jour(rang, debut, valeurs): debut is YYYY-MM-DD (the day), valeurs 24 kWh per local hour separated by ; (empty field = no data, an hour to come) — exactly the shape of tab5_maj_energie_historique for the hours view, and exactly the jour_1 / jour_2 strings that script.tab5_voitures_analyse already returns (ADR-0074), pushed as they are. It is a service of its own rather than a new vue of tab5_maj_energie_historique: that one feeds the production graph and the balance, and its vue values are a public choice of three; a car series is keyed by a rank, and an older firmware that lacks it must refuse a call that changes nothing for the others (continue_on_error). rang is 0, 1 or 2: 1 and 2 are the cars of tab5_maj_voiture; 0 is the home without the cars, which the plan left to define and the analysis did not give.
  • The home without the cars comes from the same script. tab5_voitures_analyse gets one more output string, jour_maison (24 kWh per local hour, the same method and the same hour keys as jour_1): the home power sensor's statistics summed per hour, minus the cars' charge of that hour when the sensor counts it (the blueprint's « meter counts the cars » option, as everywhere in the analysis), never below 0; empty without a home sensor or without a car; an hour with no home row stays empty. The Python reference (tools/voitures_charges.py, serie_maison) and the Jinja of the package give the same strings (tests/test_voitures.py, 32 scenarios) and the numbers are checked by hand (tests/test_voitures_charges.py). script.tab5_energie pushes the three ranks right after the charges, with the same cadence (the popup opens, then at most every 5 minutes), continue_on_error, and all three ranks every time — an empty series removes the car or the home from the page.
  • The firmware keeps one ConsoJour (3 rows × 24 hours, pure, conso_jour_lire() in Tab5/socle/tab5_parse.*, tolerant like the other readings: an empty list or an unreadable field is « no data », a negative or absurd value too; tested on a PC and fuzzed). A new debut starts from zero: yesterday's hours never mix with today's. A series with no readable hour removes its rank. The stack is drawn only for the day of the production's hours (conso_visible()): the hours series of tab5_maj_energie_historique carries its own debut, and if the popup stays open past midnight, or the analysis fails (continue_on_error) while the production keeps coming every turn, yesterday's stack would stand beside today's bars and its sun share would be wrong — the page then falls back to the one of before until the new day's series arrives.
  • The drawing, only with a car that has an hour (conso_jour_voitures(): a car row with at least one finite value — a 0 is a value: a car that reports and did not charge shows « 0.00 kWh » and the home's stack; a car for which Home Assistant sends only empty hours does not count; the home alone is not enough — without a car there is nothing to stack, and the screen must stay the one of before). Next to each hour's production bar, a stack: the home at the bottom (TEXT_DIM), car 1 on top (ACCENT), car 2 above (ACCENT_ALT — the colours of the cars on the « Charges » page, UIColor roles only); the scale (the « max » label too) counts the stack's height. Because the two series are side by side, the production and the forecast bars are thinner (34 % of the hour step instead of 62 %) and sit left of the hour's centre, the stack right of it, 2 px apart; without the layer they are what they were, centred (couche is the one condition; checked by the off-device render, byte for byte). A segment under one pixel is not drawn and the next ones start from the cumulative height. 72 segments are created once at the first build (construire_soleil), hidden.
  • A legend and a line, in the free corners. Top left of the sun zone, which the arc never reaches there: a mark, the name and the day's kWh for each series received (« Maison », the car's name or « Voiture 2 », « 5.43 kWh »). Under the best-window card of the right column, a card of the same gold: « 62 % » in bold and, beside it, « de la charge par le soleil » (tr() and the seven languages; the firmware composes the line from the numbers, Home Assistant sends none). Its text wraps on up to three lines of 22 px in 172 px.
  • The share is worked out from the hours, in the firmware (conso_jour_totaux(), pure and tested on a PC): hour by hour, what the cars took beyond what the home left of the production — min(cars, max(0, production − home)) — summed, over the cars' total, for the hours where the cars and the home are known; a missing production hour counts for 0; 0 to 100 %. It is not the share of the « Charges » page, which comes from the recorder per charge in 5-minute slots and weights each charge; at one-hour resolution a cloud of twenty minutes or a charge that starts at the end of a sunny hour are smoothed, so the two numbers can differ by some points. The page says « de la charge » of the day; the Charges page keeps its own, per charge. No card without the home series (nothing to subtract) nor when the cars took less than 10 Wh.
  • Not on the 7B (kJourVoitures = kCorpsH >= kCorpsHTab5): its page is 478 px high, the corner above the arc and the 72 px under the best-window card do not hold a legend and a three-line card, like the cars of the Flux page (ADR-0076). Nothing is created there; the service is accepted and changes nothing.
  • Contract 1.7.0, a pure addition (tab5_maj_voiture_jour); the firmware must be updated first (contrat_api.py --matrice).

Consequences

  • No car with an hour known: the page is the one of before, pixel for pixel (every existing screen of the off-device render is compared with main).
  • About 84 more LVGL objects are created at the first build of the popup (72 segments, 9 legend objects, 3 for the card), 72 more style writes (compared first) at each replay of the theme, and a ConsoJour of about 300 bytes is static; the RAM and PSRAM at run time, the time of the first build and the cost of a theme switch were not measured.
  • The current hour is partial in both series (rows up to now), like the cars' hours of ADR-0074: its bar is shorter than the hour will be. At midnight the tablet starts the new day from zero at the first push of the new debut; between the two it shows the end of yesterday.
  • A car removed from the blueprint after hours were received keeps its series on the tablet until the next push of an empty one, which script.tab5_energie makes only while it runs: the same limit as the cars of ADR-0076.
  • The stack is in kWh per hour, the production bars too: the production read from the energy counters and the consumption from the power sensors' means agree to the extent the sensors do (the analysis @limits).
  • debut is compared as text with the day of the production's hours, YYYY-MM-DD both sides (Home Assistant sends it zero-padded, as the analysis writes it): another spelling would hide the stack, silently, until the next push; the firmware does not parse the date a second time.
  • Not judged on the real screen: the legibility of 8-pixel-wide stacks, the legend on top of the learned clear-sky curve on a very sunny day, the three-line card in German. The off-device render shows them; the author's eye on the tablet decides.