feat(signage): the weather all the way: a week, the next hours, feels like, humidity, wind, rain chance, sunrise / sunset, UV, in words; row, column, card, list of days or hourly layouts

services/weather.py asks Open-Meteo for 7 days, the next 24 hours and the details
(mph for Fahrenheit); older answers without them still read. The widget's layout,
the details it adds and the place's name; up to 7 days. Plan 6R.18, F-116.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-22 15:07:03 +02:00
co-authored by Claude Opus 5.5
parent 673113aff7
commit 84c2d5b2d8
10 changed files with 301 additions and 43 deletions
+9 -4
View File
@@ -263,9 +263,14 @@ class Widget(_Strict):
qr_target: Literal["ordering", "menu", "custom"] = "ordering"
qr_url: Optional[str] = Field(default=None, max_length=300)
qr_caption: Optional[str] = Field(default=None, max_length=80)
weather_days: int = Field(default=1, ge=1, le=3) # how many days, from weather_from
weather_from: int = Field(default=0, ge=0, le=2) # 0 today (now), 1 tomorrow, 2 the day after
weather_days: int = Field(default=1, ge=1, le=7) # how many days, from weather_from (6R.18: up to a week)
weather_from: int = Field(default=0, ge=0, le=6) # 0 today (now), 1 tomorrow, 2 the day after…
weather_style: Literal["both", "icon", "text"] = "both" # picture and degrees, the picture, the degrees
# 6R.18: how it is laid out, the details it adds, the hours of an hourly one, the place's name
weather_layout: Literal["row", "column", "card", "list", "hourly"] = "row"
weather_details: List[Literal["feels", "humidity", "wind", "rain", "sun", "uv", "words"]] = Field(default_factory=list, max_length=7)
weather_hours: int = Field(default=6, ge=3, le=12)
weather_place: bool = False
board: Optional[MenuList] = None # menu: what it lists and how
# its look (owner review 5, 2026-11-21): None = the slide's
vertical: Literal["auto", "top", "middle", "bottom"] = "auto" # inside its place (a stack's part, its box)
@@ -367,8 +372,8 @@ class Widget(_Strict):
self.board = MenuList(select="all", columns=1)
if self.kind != "menu":
self.board = None
if self.weather_from + self.weather_days > 3:
self.weather_days = 3 - self.weather_from # the forecast has three days
if self.weather_from + self.weather_days > 7:
self.weather_days = 7 - self.weather_from # the forecast has seven days
return self
@field_validator("qr_url")