From 5fab64bd4d18324b16531ae05104b9423282716c Mon Sep 17 00:00:00 2001 From: thekiwismarthome <134335563+thekiwismarthome@users.noreply.github.com> Date: Fri, 13 Feb 2026 21:19:07 +1300 Subject: [PATCH] Update __init__.py --- custom_components/shopping_list_manager/__init__.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/custom_components/shopping_list_manager/__init__.py b/custom_components/shopping_list_manager/__init__.py index 9c3f8cf..7318487 100644 --- a/custom_components/shopping_list_manager/__init__.py +++ b/custom_components/shopping_list_manager/__init__.py @@ -32,8 +32,12 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: component_path = os.path.dirname(__file__) config_path = hass.config.path() - # Initialize storage - storage = ShoppingListStorage(hass, component_path) + # Get country from config entry (defaults to NZ) + 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() # Initialize image handler @@ -42,7 +46,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: # Store instances in hass.data hass.data.setdefault(DOMAIN, {}) 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 await _async_register_websocket_handlers(hass, storage)