custom_components/bahmcloud_store/__init__.py aktualisiert

This commit is contained in:
2026-01-15 13:35:18 +00:00
parent 3773b07650
commit 6ca193580d

View File

@@ -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))