From e0a32668db3a83f1ef60b3d2d5b1b2cbfdd6dba0 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Wed, 11 Feb 2026 10:17:04 +0100 Subject: [PATCH] Register notfound panel --- homeassistant/components/frontend/__init__.py | 3 +- tests/components/frontend/test_init.py | 36 ------------------- 2 files changed, 2 insertions(+), 37 deletions(-) diff --git a/homeassistant/components/frontend/__init__.py b/homeassistant/components/frontend/__init__.py index 88d30414f36..8d34319cb7e 100644 --- a/homeassistant/components/frontend/__init__.py +++ b/homeassistant/components/frontend/__init__.py @@ -590,6 +590,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: ) async_register_built_in_panel(hass, "profile") + async_register_built_in_panel(hass, "notfound") @callback def async_change_listener( @@ -923,7 +924,7 @@ def websocket_get_panels( if config_override else panel.require_admin ) - if not user_is_admin and require_admin and panel_key != "home": + if not user_is_admin and require_admin: continue panels[panel_key] = panel.to_response(config_override) diff --git a/tests/components/frontend/test_init.py b/tests/components/frontend/test_init.py index 6b96f4bf43b..09a371c8388 100644 --- a/tests/components/frontend/test_init.py +++ b/tests/components/frontend/test_init.py @@ -1421,39 +1421,3 @@ async def test_update_panel_hide_sidebar( msg = await ws_client.receive_json() assert msg["result"]["light"]["title"] == "light" assert msg["result"]["light"]["icon"] == "mdi:lamps" - - -async def test_home_panel_always_visible( - hass: HomeAssistant, - ws_client: MockHAClientWebSocket, - hass_admin_user: MockUser, -) -> None: - """Test that the home panel is always returned even with require_admin.""" - # Set home panel to require_admin - await ws_client.send_json( - { - "id": 1, - "type": "frontend/update_panel", - "url_path": "home", - "require_admin": True, - } - ) - msg = await ws_client.receive_json() - assert msg["success"] - - # Make user non-admin - hass_admin_user.groups = [] - - # Home panel should still be present for non-admin - await ws_client.send_json({"id": 2, "type": "get_panels"}) - msg = await ws_client.receive_json() - assert "home" in msg["result"] - - # Other admin panels should be filtered out - async_register_built_in_panel( - hass, "admin_only", "Admin", "mdi:lock", require_admin=True - ) - await ws_client.send_json({"id": 3, "type": "get_panels"}) - msg = await ws_client.receive_json() - assert "admin_only" not in msg["result"] - assert "home" in msg["result"]