Aller au contenu

ADR-0081: The « Voitures » popup, « État » page

Page en anglais

Cette page n'existe qu'en anglais.

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

Context

ADR-0079 built the « Voitures » popup with its first page, « Aperçu », and left out what no field carried yet: the tyres, the temperatures, the lock, the Sentry mode, the software. Lot 7 of the author's plan for the cars (sketch C4, « État ») adds them as a second page. The popup had one page and no tabs; the plan gives it up to four (Aperçu, Charge, Trajets, État: lots 6 to 9), written by parallel sessions; the way a page is added is the one of lot 8 (the table kPages, ADR-0082, written in parallel), which this lot takes as it is.

Decision

  • Eleven fields at the END of tab5_maj_voiture. pneu_av_g|pneu_av_d|pneu_ar_g|pneu_ar_d|unite_pression|temp_int|temp_ext|unite_temperature|verrouillee|sentinelle|logiciel_a_jour after the ten of ADR-0076: twenty-one in all. No new service and no new variable, so the contract stays at 1.7.0 (contrat_api.py --check; --semver asks for nothing). An older payload of ten fields is still read (a missing field is empty, an extra one is ignored by an older firmware), so both orders of update work: firmware first shows nothing new until Home Assistant sends the fields; Home Assistant first sends fields an older tablet drops. Read by voiture_lire() (Tab5/socle/tab5_parse.*, pure, tested on a PC with the old payload, the full one, every unit, out-of-range values, and fuzzed with four new seeds). Every field is optional: empty = unknown.
  • Pressures are shown in the unit they come in. unite_pression is bar, psi, kPa, hPa, mbar, cbar or Pa (empty = bar); the tablet writes « 2.9 bar », « 42 psi », « 290 kPa » and never converts what it shows. It converts to bar only for the verdict (pression_en_bar()). A tyre is read when its value in bar is above 0 and at most 10; an unknown unit makes the four tyres unknown (a wrong number is worse than « -- »). The verdict (voiture_pneus_verdict()) needs the four: « Pneus corrects » in green, or « Pression basse » in orange when one is under 2.2 bar. The 2.2 bar threshold is this lot's choice, not a rule of Tesla's; it is one constant (kVoiturePneuBasBar).
  • Temperatures in °C or °F (empty = °C), shown rounded in the unit received (« 19 °C »); a value outside −100 to 200 is unknown. Lock, Sentry, software are 1 yes, 0 no, anything else unknown (VoitureOuiNon): « Verrouillées » / « Déverrouillées », « Activée » / « Désactivée », « À jour » / « À mettre à jour ».
  • The page, in new files. Tab5/ecran/tab5_voitures_etat.{h,cpp} and five templates (voitures_page_etat.yaml, voitures_etat_haut.yaml, voitures_etat_bas.yaml, voitures_etat_ligne.yaml, voitures_etat_pression.yaml). Per car, two cards one under the other: on top the name, the verdict of the tyres and the car seen from above — front to the right, so the left side is the top —, four tyres, the body and three windows drawn in C++ with plain rectangles (no image in flash, colours from the palette), the pressure of each tyre beside it, aligned toward the car and orange when low; below five lines (Cabine, Extérieur, Portes, Sentinelle, Logiciel), each an icon, a label and a value. Two cars: a column each; one car: full width, its content in the column of a half card, like the Aperçu. A value Home Assistant does not give reads « -- » in the dim colour. A car that gives nothing keeps its column (« -- » everywhere) while the other has something. The icons are in mdi_font_32 (five glyphs added) and in MDI_CODE_TARGETS (rule 9); the widgets of the templates are bound by their order (counted at the first use: a template that changed without the C++ logs it and shows nothing rather than crashing).
  • A page exists only with data (ADR-0046). « État » is shown once a car gave at least one of the eleven fields; « Aperçu » is always there (without a car it still says « Aucune voiture reçue »); the tabs appear from two pages. The page the finger chose is kept from one opening to the next as long as it exists, then the popup falls back to the first. A left / right swipe changes the page (pages_brancher(), the popup's PagesPopup), the tabs are pages_onglet.yaml buttons (200 px each up to four pages, 158 px at five). The Aperçu paints exactly as before: without an État field every existing screen is the one of before.
  • How the page joins the popup (the mechanism is lot 8's, ADR-0082): one line in the table kPages of tab5_voitures.cpp — the tab name marked tr_noop, « has data », « show / hide » and « paint », four captureless lambdas calling voitures_etat_a_donnees(), voitures_etat_montrer(), voitures_etat_peindre() — and the header in tab5_custom.h. Unlike the other pages, which create their widgets in C++ under voitures_corps(), this one keeps its cards as YAML templates (the icons stay checked by rule 9) in one container, voitures_page_etat, bound by voitures_etat_lier() in the script tab5_voitures_lier; the container must be a child of voitures_corps() (checked at binding) and the car's name is read through voiture_recue(), not copied again.
  • Home Assistant. The blueprint section « Énergie : voitures » gets, per car, nine optional entity pickers (four tyres, cabin and outside temperature, lock, Sentry, software), none required: the tyre and temperature sensors by their device class, the lock as a lock entity or a binary_sensor of the lock class, the Sentry mode as a switch or a binary_sensor, the software as an update entity. packages/tab5_energie.yaml reads them and appends the eleven fields; the chosen sensors also relaunch the instant when they change. Each pressure is sent as it is, in the unit of the first tyre that has a value (a tyre in another unit stays empty, never converted wrongly), only in a unit the tablet knows; temperatures follow the same rule. The meanings are Home Assistant's: a lock is locked = 1; a binary_sensor of class lock is inverted (off = locked); a Sentry switch on = 1; an update entity on = an update is waiting = 0. The blueprint and the package say that the Tesla integrations (Fleet, Teslemetry) ship the tyre pressure sensors disabled by default: they are enabled on the device page (disabled entities), otherwise the page reads « -- » for them. This comes from the plan; it was not checked against a real Tesla (there is none here).
  • Texts through tr() in the seven languages (ten new keys; « Activée », « Désactivée », « Extérieur », « État » and the rest already existed). The demo pusher (--voitures) sends the two cars with their state (the second has a soft tyre, an unlocked door, Sentry on and an update waiting); tools/rendu/ecrans.py has five new screens (the Aperçu with its tabs, the État page with two cars, one car, in psi and °F, and half filled), the older screens keep the cars without state.

Consequences

  • Not verified on real data. No Tesla is available: the page was checked with the demo values, the unit tests of the reader and the package, the fuzzer and the off-device render, never with an integration's real entities (their device classes, units and states are those the plan reports). The tablet was not flashed.
  • Home Assistant pushes eleven more fields every time it pushes a car (a few characters; the pushes are the ones of before). The tablet keeps the state of each car in a small structure (about 110 bytes a car) and creates the page's widgets (37 per car: the two cards, their 28 labels and lines, the eight shapes of the drawing) at the first painting of the page.
  • Measured cost (compiled on the PC on 2026-11-10, head 286d2764 = this page merged with the « Charge » page of ADR-0082, not flashed): Tab5 RAM 61.5 % (273 818 of 445 392 bytes), flash 65.3 % (5 308 618 of 8 126 464), config_hash 0x9ceb3ce9; Waveshare 7B RAM 51.7 % (270 866 of 524 288), flash 27.9 % (4 604 020 of 16 515 072), config_hash 0x29006f1e. No build of main was made beside it, so the size of the page itself is not measured.
  • A pressure under 2.2 bar paints its tyre and its figure in orange whatever the car's own warning says: the verdict is the tablet's, from the numbers it is given.
  • The car drawing is generic, like the silhouette of the Aperçu: one body for every make.
  • The order of the tabs is the order of kPages: Aperçu, Charge, Trajets, État.