mirror of
https://github.com/thekiwismarthome/shopping-list-manager.git
synced 2026-05-01 11:46:30 +00:00
Update __init__.py
This commit is contained in:
@@ -32,8 +32,12 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
component_path = os.path.dirname(__file__)
|
component_path = os.path.dirname(__file__)
|
||||||
config_path = hass.config.path()
|
config_path = hass.config.path()
|
||||||
|
|
||||||
# Initialize storage
|
# Get country from config entry (defaults to NZ)
|
||||||
storage = ShoppingListStorage(hass, component_path)
|
country = entry.data.get("country", "NZ")
|
||||||
|
_LOGGER.info("Using country: %s", country)
|
||||||
|
|
||||||
|
# Initialize storage with country
|
||||||
|
storage = ShoppingListStorage(hass, component_path, country)
|
||||||
await storage.async_load()
|
await storage.async_load()
|
||||||
|
|
||||||
# Initialize image handler
|
# Initialize image handler
|
||||||
@@ -42,7 +46,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
# Store instances in hass.data
|
# Store instances in hass.data
|
||||||
hass.data.setdefault(DOMAIN, {})
|
hass.data.setdefault(DOMAIN, {})
|
||||||
hass.data[DOMAIN][DATA_STORAGE] = storage
|
hass.data[DOMAIN][DATA_STORAGE] = storage
|
||||||
hass.data[DOMAIN]["image_handler"] = image_handler # NEW
|
hass.data[DOMAIN]["image_handler"] = image_handler
|
||||||
|
hass.data[DOMAIN]["country"] = country # Store for later use
|
||||||
|
|
||||||
# Register WebSocket commands
|
# Register WebSocket commands
|
||||||
await _async_register_websocket_handlers(hass, storage)
|
await _async_register_websocket_handlers(hass, storage)
|
||||||
|
|||||||
Reference in New Issue
Block a user