mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Fix homewizard api close not being awaited on unload (#122324)
This commit is contained in:
parent
02c64c7861
commit
c70e611822
@ -10,7 +10,7 @@ from .coordinator import HWEnergyDeviceUpdateCoordinator
|
|||||||
type HomeWizardConfigEntry = ConfigEntry[HWEnergyDeviceUpdateCoordinator]
|
type HomeWizardConfigEntry = ConfigEntry[HWEnergyDeviceUpdateCoordinator]
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
async def async_setup_entry(hass: HomeAssistant, entry: HomeWizardConfigEntry) -> bool:
|
||||||
"""Set up Homewizard from a config entry."""
|
"""Set up Homewizard from a config entry."""
|
||||||
coordinator = HWEnergyDeviceUpdateCoordinator(hass)
|
coordinator = HWEnergyDeviceUpdateCoordinator(hass)
|
||||||
try:
|
try:
|
||||||
@ -35,13 +35,12 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
hass.config_entries.flow.async_abort(progress_flow["flow_id"])
|
hass.config_entries.flow.async_abort(progress_flow["flow_id"])
|
||||||
|
|
||||||
# Finalize
|
# Finalize
|
||||||
|
entry.async_on_unload(coordinator.api.close)
|
||||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
async def async_unload_entry(hass: HomeAssistant, entry: HomeWizardConfigEntry) -> bool:
|
||||||
"""Unload a config entry."""
|
"""Unload a config entry."""
|
||||||
if unload_ok := await hass.config_entries.async_unload_platforms(entry, PLATFORMS):
|
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||||
entry.runtime_data.api.close()
|
|
||||||
return unload_ok
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user