diff --git a/custom_components/bahmcloud_store/__init__.py b/custom_components/bahmcloud_store/__init__.py index c00cc21..4236d53 100644 --- a/custom_components/bahmcloud_store/__init__.py +++ b/custom_components/bahmcloud_store/__init__.py @@ -7,7 +7,11 @@ from homeassistant.core import HomeAssistant from homeassistant.const import Platform from homeassistant.helpers.discovery import async_load_platform from homeassistant.helpers.event import async_track_time_interval -from homeassistant.components.panel_custom import async_register_panel + +# IMPORTANT: +# Use the frontend panel registration to keep HA header/sidebar working on mobile, +# similar to how HACS registers its panel. +from homeassistant.components.frontend import async_register_built_in_panel from .core import BCSCore, BCSConfig, BCSError @@ -32,17 +36,18 @@ async def async_setup(hass: HomeAssistant, config: dict) -> bool: # Register HTTP views (static panel assets + API) await core.register_http_views() - # Register custom panel (no iframe; uses hass.callApi) - await async_register_panel( + # Register panel via frontend (keeps navigation/header on mobile) + async_register_built_in_panel( hass, - frontend_url_path="bahmcloud-store", - webcomponent_name="bahmcloud-store-panel", - module_url="/api/bahmcloud_store_static/panel.js?v=31", + component_name="custom", sidebar_title="Bahmcloud Store", sidebar_icon="mdi:store", - require_admin=True, - embed_iframe=False, # Critical for correct navigation/header behavior on mobile + frontend_url_path="bahmcloud-store", config={}, + require_admin=True, + # module_url must be reachable without auth (we already serve it public) + # Cache-busting is fine here. + module_url="/api/bahmcloud_store_static/panel.js?v=31", ) # Initial refresh (index + custom repos + enrichment)