trail recorder: hass.data[DOMAIN] via setdefault

The CI harness sets the entry up without async_setup having created the
domain dict; the KeyError failed every WS test downstream.
This commit is contained in:
Matysh
2026-07-31 11:07:38 +03:00
parent 23daa28cf4
commit 8dbc7db0b2
+4 -1
View File
@@ -54,7 +54,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: HouseplanConfigEntry) ->
from .trails import TrailRecorder
recorder = TrailRecorder(hass, data)
await recorder.async_setup()
hass.data[DOMAIN]["trail_recorder"] = recorder
# setdefault: the CI harness sets entries up without async_setup, so
# hass.data[DOMAIN] may not exist yet — a KeyError here failed EVERY
# downstream WS test with unknown_error
hass.data.setdefault(DOMAIN, {})["trail_recorder"] = recorder
card_path = Path(__file__).parent / "frontend" / "houseplan-card.js"
plans_path = Path(hass.config.path(PLANS_DIR))