Improvements, add switch

This commit is contained in:
Andre Basche
2023-03-05 00:54:57 +01:00
parent 136a1810fc
commit 16eafff169
6 changed files with 165 additions and 22 deletions

View File

@ -38,3 +38,12 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry):
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
async def async_unload_entry(hass, entry: ConfigEntry) -> bool:
unload = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
if unload:
if not hass.data[DOMAIN]:
hass.data.pop(DOMAIN, None)
return unload