diff --git a/custom_components/bahmcloud_store/__init__.py b/custom_components/bahmcloud_store/__init__.py index 11791e8..292a93e 100644 --- a/custom_components/bahmcloud_store/__init__.py +++ b/custom_components/bahmcloud_store/__init__.py @@ -7,9 +7,7 @@ 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 - -# Built-in panel registration (keeps HA header/sidebar on mobile) -from homeassistant.components.frontend import async_register_built_in_panel +from homeassistant.components.panel_custom import async_register_panel from .core import BCSCore, BCSConfig, BCSError @@ -28,35 +26,24 @@ async def async_setup(hass: HomeAssistant, config: dict) -> bool: core = BCSCore(hass, BCSConfig(store_url=store_url)) hass.data[DOMAIN] = core - # Register HTTP views (static assets + API) await core.register_http_views() - # IMPORTANT: - # In HA 2026.1.x, async_register_built_in_panel does not accept module_url. - # The supported way is to use _panel_custom with js_url. - # This keeps the HA chrome (header/sidebar) on mobile. - async_register_built_in_panel( + await async_register_panel( hass, - component_name="custom", + frontend_url_path="bahmcloud-store", + webcomponent_name="bahmcloud-store-panel", + module_url="/api/bahmcloud_store_static/panel.js?v=32", sidebar_title="Bahmcloud Store", sidebar_icon="mdi:store", - frontend_url_path="bahmcloud-store", require_admin=True, - config={ - "_panel_custom": { - "name": "bahmcloud-store-panel", - "js_url": "/api/bahmcloud_store_static/panel.js?v=33", - } - }, + config={}, ) - # Initial refresh (index + custom repos + enrichment) try: await core.refresh() except BCSError as e: _LOGGER.error("Initial refresh failed: %s", e) - # Periodic refresh (data only; no auto installs) async def periodic(_now) -> None: try: await core.refresh() @@ -67,7 +54,5 @@ async def async_setup(hass: HomeAssistant, config: dict) -> bool: interval = timedelta(seconds=int(core.refresh_seconds or 300)) async_track_time_interval(hass, periodic, interval) - # Update platform is still a stub in 0.3.x await async_load_platform(hass, Platform.UPDATE, DOMAIN, {}, config) - return True