Aller au contenu

ADR-0077: The « Charges » page of the Energy popup

Page en anglais

Cette page n'existe qu'en anglais.

Status: Accepted (2026-11-09). Date: 2026-11-09

Context

ADR-0074 lets Home Assistant work out, from the recorder, the list of the last charges of each car, the share of the sun in each and the month's balance. ADR-0076 shows the cars on the Flux page. Nothing shows the list yet: lot 3 of the author's plan for the cars (sketch B3) is a fifth page of the Energy popup, « Charges ».

Decision

  • One service, the output of the analysis pushed as it is. tab5_maj_voiture_charges(payload): up to six lines separated by ;, the most recent first, each rang|jour|heure|duree_min|kwh|part_soleil_pct — exactly the charges string that script.tab5_voitures_analyse returns (ADR-0074), so Home Assistant converts nothing. rang is 1 or 2 (the car of tab5_maj_voiture), jour is YYYY-MM-DD and heure HH:MM, local time, of the start; duree_min in minutes, kwh received by the car, part_soleil_pct from 0 to 100. A field left empty is unknown (a charge with no solar sensor chosen has an empty share: « -- », no bar); an empty payload clears the list and the page disappears. The reading is charges_lire() (Tab5/socle/tab5_parse.*, pure, tolerant like voiture_lire(): a line with no rank 1 or 2, or with nothing readable at all, is skipped; an unreadable date or hour only leaves them blank; more than six lines are cut; tested on a PC and fuzzed). The total and the sun's share of the total are charges_total(), weighted by the kWh. The contract goes to 1.6.0 (a pure addition); the firmware must be updated first.
  • The plan's format was right — it matched the real output of the script, so nothing was corrected there. What the plan did not say: nothing in a line tells that a charge is still running. The page takes the most recent line of a car for the running one when tab5_maj_voiture says that car is charging and that line ends from 30 minutes before to 10 minutes after now (charge_en_cours(), pure, tested on a PC; green bolt instead of the car icon, green duration, a light band behind the row, « en cours » in the legend). The second condition is there because the analysis runs every 5 minutes and counts in 5-minute slots: a charge that has just begun is not in the list yet, and yesterday's line must not pass for it. An older line is never shown as running; without a set clock nothing is.
  • The fifth page. kEnergiePages is 5; the page sits between « Production » and « Bilan » (P_CHARGES = 3), has its container, its tab and its case in peindre(), and exists only once the tablet has received a charge (page_a_donnees): with no car configured the popup keeps its four tabs of 200 px and every existing screen is the same pixel for pixel. With the fifth page the five tabs are 158 px (pages_onglet_largeur, ADR-0046); the names « Aujourd'hui », « Production » and « Charges » are checked at that width in the seven languages (the German tab is « Laden »).
  • The drawing is built once at the first opening from the bricks that exist (ui_rectangle, ui_text, ui_poser; colours replayed on a theme change, UIColor roles only): a title and a legend, six rows of a car icon, the car's name, the day with its hour (« Aujourd'hui · 09:02 », « Hier », then « Dim 8 »), the duration, the kWh, a bar sun / grid and the share in %, and under the last row a total (« Total : 95.1 kWh, dont 62 % par le soleil »). Every text is 22 px or more. The bar is the sun in front of the grid on a track: not on the 7B (946 px against 1202, the day column takes its room and the percentage says the same).
  • Home Assistant side. script.tab5_energie calls script.tab5_voitures_analyse with the sensors of the blueprint's « Énergie : voitures » section (the charge power of each car, renamed puissance_charge, plus the solar sensors, the home and the « meter separate from the cars » option) and pushes the result with continue_on_error. The analysis reads thousands of statistics rows: at the first turn (the popup opens), then at most every 5 minutes (charges_t), never at each turn of the loop, and not replayed on a change of view. A car with no power sensor is not analysed; with no such car, or without the analysis script, nothing is computed or pushed; a failed analysis pushes nothing (the tablet keeps its last charges). No entity ID in the public files (ADR-0024).

Consequences

  • No car chosen: nothing is pushed, the tab is not there, the screens are those of before (proved by the off-device render compared byte for byte, and by the geometry tests).
  • With both cars removed from the blueprint after charges were received, Home Assistant pushes nothing and the tablet keeps the old list until its next restart (same limit as the cars of ADR-0076; the Charges page is the only trace).
  • The one-hour resolution of the old statistics (ADR-0074) bounds how far back the six lines go: a car that charges rarely may show fewer than six, or older ones than a week.
  • About 70 more LVGL objects are created when the popup is first built (six rows of ten, a title, a legend and a total); the RAM and PSRAM were not measured for this change.
  • Not judged on the real screen: the fit of the longest day names in the narrow 7B column and the weight of the bar. The off-device render shows both; the author's eye on the tablet decides.
  • The five tabs on the 7B (seen on the off-device render of 2026-11-09, fixed the same day). The tab strip is laid out for the Tab5 and scaled to the card, but the names are not scaled: five tabs from x 318 left 116 px on the 7B, 100 px for the name, and « Aujourd'hui » (110 px) and « Production » (104 px) showed as « Aujourd'… » and « Producti… ». pages_onglets() takes a titre_court flag, passed by this popup only: on a card narrower than the Tab5's, from five tabs on, the strip starts at x 196 (the Alarm clock's start) instead of 318, which gives 133 px (117 for the name; the widest name in the seven languages needs 113). The Tab5, four pages or fewer, and every other popup (room, remote and group names belong to the user) keep their layout.
  • The grid is violet, on both pages (the author's remark on his tablet, 2026-11-09: « the yellow is too close, you cannot tell the sun from the grid »). The grid was WARNING: behind the sun's GOLD on the Charges bar, and on the Flux circle, lines and ring shares — two yellows, a colour difference of 0 to 35 depending on the palette (none at all in « Pixel »). He chose violet, first for the bar as ACCENT_ALT, the theme's secondary accent. That does not hold: in « Calm neon », the theme of his tablet, ACCENT_ALT is a hot pink, and on Flux it is already the battery (in « Slate » the very same violet). So the grid has its own role, POWER_GRID, one value per theme and mode: A78BFA (7652E0 in light) where the theme leaves room for it, otherwise the nearest violet that does (computed once, written in Tab5/themes/*.yaml; a theme that inherits from « Slate » keeps its value when it suits). tests/test_themes.py requires, in the 42 palettes, a hue between 240° and 280°, a colour difference of 30 or more from GOLD, ACCENT_ALT, SUCCESS and INFO (the colours around it on Flux), and 3:1 on the card surfaces. Read by the Flux page (the grid circle and icon, the lines to the home, the battery and the cars, the grid share of the home's and the cars' rings) and by the Charges page (bar, legend dot). Left alone on purpose: the balance colours of the Bilan page (WARNING for a month in debt is a cost, not the grid), and the second car's icon, still ACCENT_ALT (the author keeps two icon colours, rank 1 ACCENT, rank 2 ACCENT_ALT; on the Charges rows it is therefore no longer the colour of the grid bar).