From 1e3af1b48fb52e3a583b313d36981b69a046c25b Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 26 Feb 2024 16:04:33 -1000 Subject: [PATCH] Convert person start to be a callback function (#111571) Nothing was being awaited here so there was no need to create a task per person at the start event. The async_update_config coro remains since its required by the collection but is now a wrapper around a callback _async_update_config --- homeassistant/components/person/__init__.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/person/__init__.py b/homeassistant/components/person/__init__.py index 3a7db248862..2075c3fc713 100644 --- a/homeassistant/components/person/__init__.py +++ b/homeassistant/components/person/__init__.py @@ -482,18 +482,24 @@ class Person(collection.CollectionEntity, RestoreEntity): if self.hass.is_running: # Update person now if hass is already running. - await self.async_update_config(self._config) + self._async_update_config(self._config) else: # Wait for hass start to not have race between person # and device trackers finishing setup. - async def person_start_hass(_: Event) -> None: - await self.async_update_config(self._config) + @callback + def _async_person_start_hass(_: Event) -> None: + self._async_update_config(self._config) self.hass.bus.async_listen_once( - EVENT_HOMEASSISTANT_START, person_start_hass + EVENT_HOMEASSISTANT_START, _async_person_start_hass ) async def async_update_config(self, config: ConfigType) -> None: + """Handle when the config is updated.""" + self._async_update_config(config) + + @callback + def _async_update_config(self, config: ConfigType) -> None: """Handle when the config is updated.""" self._config = config