From 8dbc7db0b2564b653a2365882078a805af38a292 Mon Sep 17 00:00:00 2001 From: Matysh Date: Fri, 31 Jul 2026 11:07:38 +0300 Subject: [PATCH] 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. --- custom_components/houseplan/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/custom_components/houseplan/__init__.py b/custom_components/houseplan/__init__.py index f3c1a91..7633e4b 100755 --- a/custom_components/houseplan/__init__.py +++ b/custom_components/houseplan/__init__.py @@ -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))