Fix tplink unloading when no switches are present (#50301)

This commit is contained in:
J. Nick Koston 2021-05-08 12:20:22 -05:00 committed by GitHub
parent 97eb4c6c62
commit 4853fb7966
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -111,7 +111,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigType):
async def async_unload_entry(hass, entry):
"""Unload a config entry."""
platforms = [platform for platform in PLATFORMS if platform in hass.data[DOMAIN]]
platforms = [platform for platform in PLATFORMS if hass.data[DOMAIN].get(platform)]
unload_ok = await hass.config_entries.async_unload_platforms(entry, platforms)
if unload_ok:
hass.data[DOMAIN].clear()