Files
wled-screen-controller-mixed/TODO.md
alexei.dolgolyov ef33935188
Some checks failed
Lint & Test / test (push) Failing after 34s
feat: add weather source entity and weather-reactive CSS source type
New standalone WeatherSource entity with pluggable provider architecture
(Open-Meteo v1, free, no API key). Full CRUD, test endpoint, browser
geolocation, IconSelect provider picker, CardSection with test/clone/edit.

WeatherColorStripStream maps WMO weather codes to ambient color palettes
with temperature hue shifting and thunderstorm flash effects. Ref-counted
WeatherManager polls API and caches data per source.

CSS editor integration: weather type with EntitySelect source picker,
speed and temperature influence sliders. Backup/restore support.

i18n for en/ru/zh.
2026-03-24 18:52:46 +03:00

2.8 KiB

Weather Source Implementation

Phase 1: Backend — Entity & Provider

  • storage/weather_source.py — WeatherSource dataclass
  • storage/weather_source_store.py — BaseJsonStore, CRUD, ID prefix ws_
  • api/schemas/weather_sources.py — Create/Update/Response Pydantic models
  • api/routes/weather_sources.py — REST CRUD + POST /{id}/test endpoint
  • core/weather/weather_provider.py — WeatherData, WeatherProvider ABC, OpenMeteoProvider, WMO_CONDITION_NAMES
  • core/weather/weather_manager.py — Ref-counted runtime pool, polls API, caches WeatherData
  • config.py — Add weather_sources_file to StorageConfig
  • main.py — Init store + manager, inject dependencies, shutdown save
  • api/__init__.py — Register router
  • api/routes/backup.py — Add to STORE_MAP

Phase 2: Backend — CSS Stream

  • core/processing/weather_stream.py — WeatherColorStripStream with WMO palette mapping + temperature shift + thunderstorm flash
  • core/processing/color_strip_stream_manager.py — Register "weather" stream type + weather_manager dependency
  • storage/color_strip_source.py — WeatherColorStripSource dataclass + registry
  • api/schemas/color_strip_sources.py — Add "weather" to Literal + weather_source_id, temperature_influence fields
  • core/processing/processor_manager.py — Pass weather_manager through ProcessorDependencies

Phase 3: Frontend — Weather Source Entity

  • templates/modals/weather-source-editor.html — Modal with provider select, lat/lon + "Use my location", update interval, test button
  • static/js/features/weather-sources.ts — Modal, CRUD, test (shows weather toast), clone, geolocation, CardSection delegation
  • static/js/core/state.ts — weatherSourcesCache + _cachedWeatherSources
  • static/js/types.ts — WeatherSource interface + ColorStripSource weather fields
  • static/js/features/streams.ts — Weather Sources CardSection + card renderer + tree nav
  • templates/index.html — Include modal template
  • static/css/modal.css — Weather location row styles

Phase 4: Frontend — CSS Editor Integration

  • static/js/features/color-strips.ts"weather" type, section map, handler, card renderer, populate dropdown
  • static/js/core/icons.ts — Weather icon in CSS type icons
  • templates/modals/css-editor.html — Weather section (EntitySelect for weather source, speed, temperature_influence)

Phase 5: i18n + Build

  • static/locales/en.json — Weather source + CSS editor keys
  • static/locales/ru.json — Russian translations
  • static/locales/zh.json — Chinese translations
  • Lint: ruff check — passed
  • Build: tsc --noEmit + npm run build — passed
  • Restart server + test