From 5ded45c3f8bd595e1907bab87f4c35d085b526e4 Mon Sep 17 00:00:00 2001 From: bahmcloud Date: Wed, 14 Jan 2026 18:47:46 +0000 Subject: [PATCH] custom_components/bahmcloud_store/update.py aktualisiert --- custom_components/bahmcloud_store/update.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/custom_components/bahmcloud_store/update.py b/custom_components/bahmcloud_store/update.py index 63686ae..2f13f13 100644 --- a/custom_components/bahmcloud_store/update.py +++ b/custom_components/bahmcloud_store/update.py @@ -17,16 +17,26 @@ async def async_setup_platform( store: BahmcloudStore = hass.data[DOMAIN] entities: dict[str, BahmcloudPackageUpdate] = {} + def should_have_update_entity(pkg: Package) -> bool: + # Store selbst immer als Update + if pkg.type == "store": + return True + # Andere Pakete nur, wenn installiert + return store.is_installed(pkg.domain) + def rebuild_entities() -> None: - # create entities for any new package in store.yaml + # Create entities for packages that qualify for pkg in store.packages.values(): + if not should_have_update_entity(pkg): + continue + uid = f"{DOMAIN}:{pkg.id}" if uid not in entities: ent = BahmcloudPackageUpdate(store, pkg.id) entities[uid] = ent async_add_entities([ent], update_before_add=True) - # refresh states + # Refresh states for ent in entities.values(): ent.async_write_ha_state()