mirror of
https://github.com/Electric-Special/ha-core.git
synced 2026-03-21 04:05:20 +01:00
Simplify ecovacs unload and register teardown before initialize (#163350)
This commit is contained in:
@@ -38,12 +38,11 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
async def async_setup_entry(hass: HomeAssistant, entry: EcovacsConfigEntry) -> bool:
|
async def async_setup_entry(hass: HomeAssistant, entry: EcovacsConfigEntry) -> bool:
|
||||||
"""Set up this integration using UI."""
|
"""Set up this integration using UI."""
|
||||||
controller = EcovacsController(hass, entry.data)
|
controller = EcovacsController(hass, entry.data)
|
||||||
|
|
||||||
|
entry.async_on_unload(controller.teardown)
|
||||||
|
|
||||||
await controller.initialize()
|
await controller.initialize()
|
||||||
|
|
||||||
async def on_unload() -> None:
|
|
||||||
await controller.teardown()
|
|
||||||
|
|
||||||
entry.async_on_unload(on_unload)
|
|
||||||
entry.runtime_data = controller
|
entry.runtime_data = controller
|
||||||
|
|
||||||
async def _async_wait_connect(device: VacBot) -> None:
|
async def _async_wait_connect(device: VacBot) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user