Wait for config entry platform forwards (#73806)
This commit is contained in:
parent
3a5cca3ff2
commit
cd03c49fc2
386 changed files with 528 additions and 557 deletions
|
@ -1,7 +1,6 @@
|
|||
"""The motionEye integration."""
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Callable
|
||||
import contextlib
|
||||
from http import HTTPStatus
|
||||
|
@ -392,20 +391,14 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||
else:
|
||||
device_registry.async_remove_device(device_entry.id)
|
||||
|
||||
async def setup_then_listen() -> None:
|
||||
await asyncio.gather(
|
||||
*(
|
||||
hass.config_entries.async_forward_entry_setup(entry, platform)
|
||||
for platform in PLATFORMS
|
||||
)
|
||||
)
|
||||
entry.async_on_unload(
|
||||
coordinator.async_add_listener(_async_process_motioneye_cameras)
|
||||
)
|
||||
await coordinator.async_refresh()
|
||||
entry.async_on_unload(entry.add_update_listener(_async_entry_updated))
|
||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||
|
||||
entry.async_on_unload(
|
||||
coordinator.async_add_listener(_async_process_motioneye_cameras)
|
||||
)
|
||||
await coordinator.async_refresh()
|
||||
entry.async_on_unload(entry.add_update_listener(_async_entry_updated))
|
||||
|
||||
hass.async_create_task(setup_then_listen())
|
||||
return True
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue