Fixing config_entries.async_forward_entry_unload calls (step 1) (#27857)

This commit is contained in:
Quentame 2019-10-20 12:15:46 +02:00 committed by Pascal Vizeli
parent c42ca94a86
commit 5ce437dc30
5 changed files with 5 additions and 19 deletions

View File

@ -19,7 +19,4 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry):
async def async_unload_entry(hass, entry): async def async_unload_entry(hass, entry):
"""Unload a config entry.""" """Unload a config entry."""
hass.async_create_task( return await hass.config_entries.async_forward_entry_unload(entry, "sensor")
hass.config_entries.async_forward_entry_unload(entry, "sensor")
)
return True

View File

@ -55,7 +55,4 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry):
async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry): async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry):
"""Unload Linky sensors.""" """Unload Linky sensors."""
hass.async_create_task( return await hass.config_entries.async_forward_entry_unload(entry, "sensor")
hass.config_entries.async_forward_entry_unload(entry, "sensor")
)
return True

View File

@ -127,8 +127,7 @@ async def async_unload_entry(hass, entry):
"""Unload a config entry.""" """Unload a config entry."""
hass.components.webhook.async_unregister(entry.data[CONF_WEBHOOK_ID]) hass.components.webhook.async_unregister(entry.data[CONF_WEBHOOK_ID])
hass.data[DOMAIN]["unsub_device_tracker"].pop(entry.entry_id)() hass.data[DOMAIN]["unsub_device_tracker"].pop(entry.entry_id)()
await hass.config_entries.async_forward_entry_unload(entry, DEVICE_TRACKER) return await hass.config_entries.async_forward_entry_unload(entry, DEVICE_TRACKER)
return True
# pylint: disable=invalid-name # pylint: disable=invalid-name

View File

@ -172,12 +172,9 @@ async def async_unload_entry(hass, config_entry):
) )
remove_listener() remove_listener()
for component in ("sensor",):
await hass.config_entries.async_forward_entry_unload(config_entry, component)
hass.data[DOMAIN][DATA_LUFTDATEN_CLIENT].pop(config_entry.entry_id) hass.data[DOMAIN][DATA_LUFTDATEN_CLIENT].pop(config_entry.entry_id)
return True return await hass.config_entries.async_forward_entry_unload(config_entry, "sensor")
class LuftDatenData: class LuftDatenData:

View File

@ -92,8 +92,4 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry):
async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry): async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry):
"""Unload Withings config entry.""" """Unload Withings config entry."""
await hass.async_create_task( return await hass.config_entries.async_forward_entry_unload(entry, "sensor")
hass.config_entries.async_forward_entry_unload(entry, "sensor")
)
return True