diff --git a/custom_components/bahmcloud_store/__init__.py b/custom_components/bahmcloud_store/__init__.py index e9e7752..07bf202 100644 --- a/custom_components/bahmcloud_store/__init__.py +++ b/custom_components/bahmcloud_store/__init__.py @@ -24,11 +24,17 @@ async def async_setup(hass: HomeAssistant, config: dict) -> bool: core = BCSCore(hass, BCSConfig(store_url=store_url)) hass.data[DOMAIN] = core - # Avoid blocking IO during setup await core.async_initialize() - # Register HTTP views and panel - from .views import StaticAssetsView, BCSApiView, BCSReadmeView, BCSCustomRepoView, BCSInstallView, BCSUpdateView, BCSRestartView + from .views import ( + StaticAssetsView, + BCSApiView, + BCSReadmeView, + BCSCustomRepoView, + BCSInstallView, + BCSUpdateView, + BCSRestartView, + ) hass.http.register_view(StaticAssetsView()) hass.http.register_view(BCSApiView(core)) @@ -42,14 +48,14 @@ async def async_setup(hass: HomeAssistant, config: dict) -> bool: hass, frontend_url_path="bahmcloud-store", webcomponent_name="bahmcloud-store-panel", - module_url="/api/bahmcloud_store_static/panel.js?v=99", + # IMPORTANT: bump v to avoid caching old JS + module_url="/api/bahmcloud_store_static/panel.js?v=101", sidebar_title="Bahmcloud Store", sidebar_icon="mdi:store", require_admin=True, config={}, ) - # Initial refresh try: await core.full_refresh(source="startup") except BCSError as e: @@ -60,7 +66,7 @@ async def async_setup(hass: HomeAssistant, config: dict) -> bool: await core.full_refresh(source="timer") except BCSError as e: _LOGGER.warning("Periodic refresh failed: %s", e) - except Exception as e: + except Exception as e: # pylint: disable=broad-exception-caught _LOGGER.exception("Unexpected error during periodic refresh: %s", e) interval_seconds = int(getattr(core, "refresh_seconds", 300) or 300)