Skip to content

Commit 2d6f884

Browse files
daraujoclaude
andcommitted
fix: guard remove_extra_js_url against missing hass.data key
frontend.remove_extra_js_url raises KeyError('frontend_extra_module_url') when the integration was loaded via the Lovelace resource path (so add_extra_js_url was never called and the key was never populated). Wrap in try/except so unload is always clean regardless of which registration path was used. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 380472f commit 2d6f884

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

custom_components/securitas/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,10 @@ async def _unregister_card_resource(hass: HomeAssistant) -> None:
349349
resource_id = hass.data.get(DOMAIN, {}).get("card_resource_id")
350350
if not resource_id:
351351
# Was using add_extra_js_url fallback or user-managed resource
352-
frontend.remove_extra_js_url(hass, CARD_URL)
352+
try:
353+
frontend.remove_extra_js_url(hass, CARD_URL)
354+
except Exception:
355+
pass
353356
return
354357
try:
355358
lovelace_data = hass.data.get("lovelace")

0 commit comments

Comments
 (0)