mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Move up setup of service to make it more robust when running multiple instances of deCONZ (#77621)
This commit is contained in:
parent
8eaadc0aaf
commit
6b361b70c9
@ -43,6 +43,9 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
|
|||||||
except AuthenticationRequired as err:
|
except AuthenticationRequired as err:
|
||||||
raise ConfigEntryAuthFailed from err
|
raise ConfigEntryAuthFailed from err
|
||||||
|
|
||||||
|
if not hass.data[DOMAIN]:
|
||||||
|
async_setup_services(hass)
|
||||||
|
|
||||||
gateway = hass.data[DOMAIN][config_entry.entry_id] = DeconzGateway(
|
gateway = hass.data[DOMAIN][config_entry.entry_id] = DeconzGateway(
|
||||||
hass, config_entry, api
|
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 async_setup_events(gateway)
|
||||||
await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS)
|
await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS)
|
||||||
|
|
||||||
if len(hass.data[DOMAIN]) == 1:
|
|
||||||
async_setup_services(hass)
|
|
||||||
|
|
||||||
api.start()
|
api.start()
|
||||||
|
|
||||||
config_entry.async_on_unload(
|
config_entry.async_on_unload(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user