Add WLED unload entry result correctly (#45783)

This commit is contained in:
Franck Nijhof 2021-01-31 18:59:39 +01:00 committed by GitHub
parent 2d10c83150
commit f1d3af1a13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -72,19 +72,22 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload WLED config entry."""
# Unload entities for this entry/device.
await asyncio.gather(
*(
hass.config_entries.async_forward_entry_unload(entry, component)
for component in WLED_COMPONENTS
unload_ok = all(
await asyncio.gather(
*(
hass.config_entries.async_forward_entry_unload(entry, component)
for component in WLED_COMPONENTS
)
)
)
# Cleanup
del hass.data[DOMAIN][entry.entry_id]
if unload_ok:
del hass.data[DOMAIN][entry.entry_id]
if not hass.data[DOMAIN]:
del hass.data[DOMAIN]
return True
return unload_ok
def wled_exception_handler(func):