diff --git a/custom_components/shopping_list_manager/__init__.py b/custom_components/shopping_list_manager/__init__.py index 50aae81..3ed43fe 100644 --- a/custom_components/shopping_list_manager/__init__.py +++ b/custom_components/shopping_list_manager/__init__.py @@ -39,9 +39,15 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: # Initialize storage with country storage = ShoppingListStorage(hass, component_path, country) await storage.async_load() - + + # Initialize search engine after products are loaded + self._search_engine = ProductSearch(self._products) + _LOGGER.debug("Initialized product search engine") + # Initialize image handler image_handler = ImageHandler(hass, config_path) + + self._search_engine: Optional[ProductSearch] = None # Store instances in hass.data hass.data.setdefault(DOMAIN, {})