add enabled field

This commit is contained in:
Mikhail Epifanov
2024-01-11 23:09:42 +01:00
parent f1b41461db
commit a61f79507b
10 changed files with 18 additions and 7 deletions

View File

@@ -16,4 +16,5 @@ class Connector(ABC):
async def on_shopping_list_entry_deleted(self, space: Space, instance: ShoppingListEntry) -> None:
pass
# TODO: Maybe add an 'IsEnabled(self) -> Bool' to here
# TODO: Add Recipes & possibly Meal Place listeners/hooks (And maybe more?)

View File

@@ -35,7 +35,7 @@ class ConnectorManager:
connectors: List[Connector] = self._connectors[space.name]
else:
with scope(space=space):
connectors: List[Connector] = [HomeAssistant(config) for config in space.homeassistantconfig_set.all()]
connectors: List[Connector] = [HomeAssistant(config) for config in space.homeassistantconfig_set.all() if config.enabled]
self._connectors[space.name] = connectors
if len(connectors) == 0 or purge_connector_cache: