Aller au contenu

ADR-0087: A « Normale » page in the Weather popup: today against the normals of the month

Page en anglais

Cette page n'existe qu'en anglais.

Status: Accepted (2026-11-29, the author's choice of sketch D among four). Date: 2026-11-29

Context

Vigie, the open API of the same author, reads twice a day the climate sheets of Météo-France (normals 1991-2020 and records of the nearest station, France and its overseas territories). Since vigie-api #201 its Home Assistant integration has a sensor « Écart à la normale » (<entry_id>_normal_gap): its state is today's forecast maximum minus the normal maximum of the month, its attributes the verdict (records first, then milder / cooler / near the normal under 1 °C judged on the tenth), the day's forecast, both normals, both gaps, the records of the month with their day, the rain of the day and the one-day rain record, the station and its distance. Every attribute can be null (never 0); outside France the sensor has no attributes at all. The Weather popup (ADR-0043) had three pages and nothing about the climate.

Decision

  • A fourth page « Normale », after « Détails », in the popup with pages of ADR-0046 (swipe, name at the top at x 948 like the fourth page of the Settings). One glass card of the whole body, drawn in C++ (Tab5/ecran/tab5_meteo_normale.cpp) with rectangles, no lv_chart:
  • a title in the colour of the verdict (« Plus doux que la normale de novembre », « Record de froid de novembre battu »…), then the gaps of the day and of the night to the tenth with a decimal comma and a real minus sign (U+2212, added to the &latin1 glyph set and to kHorsLatin1), only those that are known;
  • a horizontal thermometer graduated every 5 °C (10 °C past a 60 °C span): the band of the normals in grey with their values under it, the day's forecast as a bar in the temperature colours, the cold record in blue and the heat record in red with their date (« 1er novembre 2020 »), the forecast maximum; the scale is bounded by what is known plus a margin, never fixed; labels over the track are spread so that they never touch, and dropped in a fixed order when there is no room (first the forecast maximum's text, then the dates);
  • the rain of the day and the one-day rain record of the month with its date; the station, its distance and the source (« Météo-France, normales 1991-2020 ») in the footer.
  • A new service tab5_maj_normale (one payload, seventeen |-separated fields in the sensor's units, an empty field = unknown; contract 1.9.0, minor: the firmware first). The reading is pure and tested on a PC (normale_lire, normale_echelle, etiquettes_etaler, normale_titre, normale_ecarts_texte, normale_date_texte, normale_nombre in Tab5/socle/tab5_parse.*, cases in tools/test_parse.cpp, fuzzed as family I).
  • No normals, no page: an empty payload, or one without a month or without both normals (outside France, Vigie not installed), removes the page and its tab; the popup is then the one of before, three pages. Chosen over a sentence « Pas de normales pour ce lieu » because it is the simplest and leaves a home without Vigie exactly as it was. The day the month changes, Vigie keeps the normals of the month before until it reads them again: the page stays, titled « Normales de novembre », without the day.
  • Home Assistant: sensor.tab5_sources_meteo finds the sensor like Vigie's « niveau maximal » (attribute vigie_normale): the place of the chosen weather entity first, recognised by its attributes verdict and normal_max_c, else by its class temperature_delta (an empty sensor outside France), never by its entity ID (which follows the language of Home Assistant). A template sensor « Tab5 · normal » (sensor.tab5_normale) turns it into the payload (station without its department, in title case; numbers to the tenth with a dot; dates YYYY-MM-DD); script.tab5_push_meteo pushes it before its weather-source guard, on change of sensor.tab5_normale and on (re)connection, continue_on_error for an older firmware.
  • The demo pushes the real numbers of Biarritz on 2026-11-22 in every scene (the minimal house: an empty payload): the demo is in June, but the page names its month and no number is invented under the name of Météo-France.

Consequences

  • One more push at each change of the sensor (twice a day) and at each connection; the tablet compares the payload and repaints nothing when it did not change.
  • The texts are in the seven screen languages; « de novembre » / « d'avril » are translated whole (twelve keys) for the elision.
  • The page is drawn for the Tab5's body and brought to the 7B's (hauteur_carte, largeur_carte, rows placed at the real height of each font); tests/test_meteo_popup.py checks the zone on both boards.
  • Verified: the reading, the scale, the spreading and the texts on a PC (tools/test_parse.cpp), the Home Assistant templates with jinja2 (tests/test_normale_vigie.py: Biarritz, two places, outside France, no Vigie, no integration, the day the month changes, odd values), esphome config for the Tab5 and the 7B, the CI build, the off-device render (meteo-normale, meteo-sans-normale). Not verified: the page on the real screens, the sensor of a real Home Assistant (not deployed).