From 27d46eed67e2c3d8f7e12715bd6603432b5272bb Mon Sep 17 00:00:00 2001 From: Jonathan Davey Date: Wed, 8 May 2024 09:12:32 +0100 Subject: [PATCH] Update __init__.py Correcting issue found under https://github.com/hass-agent/HASS.Agent/issues/75#issuecomment-2090094046 --- custom_components/hass_agent/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/custom_components/hass_agent/__init__.py b/custom_components/hass_agent/__init__.py index 73f81c8..13e4d5f 100644 --- a/custom_components/hass_agent/__init__.py +++ b/custom_components/hass_agent/__init__.py @@ -24,7 +24,7 @@ _logger = logging.getLogger(__name__) -def update_device_info(hass: HomeAssistant, entry: ConfigEntry, new_device_info): +async def update_device_info(hass: HomeAssistant, entry: ConfigEntry, new_device_info): device_registry = dr.async_get(hass) device_registry.async_get_or_create( config_entry_id=entry.entry_id, @@ -136,12 +136,12 @@ def get_device_info(): sub_state = hass.data[DOMAIN][entry.entry_id]["internal_mqtt"] - def updated(message: ReceiveMessage): + async def updated(message: ReceiveMessage): payload = json.loads(message.payload) cached = hass.data[DOMAIN][entry.entry_id]["apis"] apis = payload["apis"] - update_device_info(hass, entry, payload) + await update_device_info(hass, entry, payload) if cached != apis: hass.async_create_task(handle_apis_changed(hass, entry, apis))