mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 09:17:10 +00:00
Fix Vera race condition on start (#45535)
This commit is contained in:
parent
ad677b9d41
commit
d110d42913
@ -110,9 +110,6 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
|
|||||||
# Initialize the Vera controller.
|
# Initialize the Vera controller.
|
||||||
subscription_registry = SubscriptionRegistry(hass)
|
subscription_registry = SubscriptionRegistry(hass)
|
||||||
controller = veraApi.VeraController(base_url, subscription_registry)
|
controller = veraApi.VeraController(base_url, subscription_registry)
|
||||||
await hass.async_add_executor_job(controller.start)
|
|
||||||
|
|
||||||
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, controller.stop)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
all_devices = await hass.async_add_executor_job(controller.get_devices)
|
all_devices = await hass.async_add_executor_job(controller.get_devices)
|
||||||
@ -151,6 +148,13 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
|
|||||||
hass.config_entries.async_forward_entry_setup(config_entry, platform)
|
hass.config_entries.async_forward_entry_setup(config_entry, platform)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def stop_subscription(event):
|
||||||
|
"""Stop SubscriptionRegistry updates."""
|
||||||
|
controller.stop()
|
||||||
|
|
||||||
|
await hass.async_add_executor_job(controller.start)
|
||||||
|
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, stop_subscription)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user