From 6b361b70c936f5c5bca536bd36fe37e7ac486a4f Mon Sep 17 00:00:00 2001 From: Robert Svensson <Kane610@users.noreply.github.com> Date: Fri, 2 Sep 2022 03:33:55 +0200 Subject: [PATCH] Move up setup of service to make it more robust when running multiple instances of deCONZ (#77621) --- homeassistant/components/deconz/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/deconz/__init__.py b/homeassistant/components/deconz/__init__.py index cb4715f3c28..4750c40fab2 100644 --- a/homeassistant/components/deconz/__init__.py +++ b/homeassistant/components/deconz/__init__.py @@ -43,6 +43,9 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b except AuthenticationRequired as err: raise ConfigEntryAuthFailed from err + if not hass.data[DOMAIN]: + async_setup_services(hass) + gateway = hass.data[DOMAIN][config_entry.entry_id] = DeconzGateway( hass, config_entry, api ) @@ -53,9 +56,6 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b await async_setup_events(gateway) await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS) - if len(hass.data[DOMAIN]) == 1: - async_setup_services(hass) - api.start() config_entry.async_on_unload( -- GitLab