mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +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]
|
||||
|
||||
|
||||
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."""
|
||||
coordinator = HWEnergyDeviceUpdateCoordinator(hass)
|
||||
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"])
|
||||
|
||||
# Finalize
|
||||
entry.async_on_unload(coordinator.api.close)
|
||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||
|
||||
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."""
|
||||
if unload_ok := await hass.config_entries.async_unload_platforms(entry, PLATFORMS):
|
||||
entry.runtime_data.api.close()
|
||||
return unload_ok
|
||||
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||
|
Loading…
x
Reference in New Issue
Block a user