diff --git a/custom_components/bahmcloud_store/__init__.py b/custom_components/bahmcloud_store/__init__.py index 1e51e54..64d26cd 100644 --- a/custom_components/bahmcloud_store/__init__.py +++ b/custom_components/bahmcloud_store/__init__.py @@ -1,6 +1,7 @@ from __future__ import annotations import logging + from homeassistant.core import HomeAssistant from .core import BCSCore @@ -17,14 +18,27 @@ DOMAIN = "bahmcloud_store" async def async_setup(hass: HomeAssistant, config: dict) -> bool: - # Übergib config korrekt an den Core + # Your BCSCore requires config in __init__ core = BCSCore(hass, config) - await core.async_setup() + + # Call optional setup methods if they exist (keep compatibility with your working core) + try: + if hasattr(core, "setup"): + res = core.setup() + if hasattr(res, "__await__"): + await res + elif hasattr(core, "start"): + res = core.start() + if hasattr(res, "__await__"): + await res + except Exception as e: + _LOGGER.exception("BCSCore setup/start failed: %s", e) + return False hass.data.setdefault(DOMAIN, {}) hass.data[DOMAIN]["core"] = core - # Register HTTP views (wie in der stabilen Version) + # Register HTTP views hass.http.register_view(StaticAssetsView()) hass.http.register_view(BCSApiView(core)) hass.http.register_view(BCSCustomRepoView(core))