Fix Soma integration reload (#44750)

* fix async_unload_entry so that component reload works from GUI

* update to use asyncio based on review feedback
pull/44791/head
badguy99 2021-01-03 02:38:45 +00:00 committed by GitHub
parent 3de0610909
commit cc21639f00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 1 deletions

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):