mirror of
https://github.com/Matysh/houseplan-card
synced 2026-08-01 00:48:29 +00:00
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:
@@ -54,7 +54,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: HouseplanConfigEntry) ->
|
|||||||
from .trails import TrailRecorder
|
from .trails import TrailRecorder
|
||||||
recorder = TrailRecorder(hass, data)
|
recorder = TrailRecorder(hass, data)
|
||||||
await recorder.async_setup()
|
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"
|
card_path = Path(__file__).parent / "frontend" / "houseplan-card.js"
|
||||||
plans_path = Path(hass.config.path(PLANS_DIR))
|
plans_path = Path(hass.config.path(PLANS_DIR))
|
||||||
|
|||||||
Reference in New Issue
Block a user