Fix Soma integration reload (#44750)

* fix async_unload_entry so that component reload works from GUI

* update to use asyncio based on review feedback
This commit is contained in:
badguy99
2021-01-03 02:38:45 +00:00
committed by GitHub
parent 3de0610909
commit cc21639f00

View File

@@ -1,4 +1,5 @@
"""Support for Soma Smartshades."""
import asyncio
import logging
from api.soma_api import SomaApi
@@ -63,7 +64,16 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry):
async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry):
"""Unload a config entry."""
return True
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in SOMA_COMPONENTS
]
)
)
return unload_ok
class SomaEntity(Entity):