mirror of
https://github.com/Andre0512/hon.git
synced 2025-08-04 07:41:02 +00:00
correct usage of async_forward_entry_setups instead of the deprecated async_forward_entry_setup
This commit is contained in:
parent
70eb6c0111
commit
eb9d48a97b
|
@ -53,10 +53,8 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool
|
||||||
hass.data.setdefault(DOMAIN, {})
|
hass.data.setdefault(DOMAIN, {})
|
||||||
hass.data[DOMAIN][entry.unique_id] = {"hon": hon, "coordinator": coordinator}
|
hass.data[DOMAIN][entry.unique_id] = {"hon": hon, "coordinator": coordinator}
|
||||||
|
|
||||||
for platform in PLATFORMS:
|
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||||
hass.async_create_task(
|
|
||||||
hass.config_entries.async_forward_entry_setup(entry, platform)
|
|
||||||
)
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@ -66,8 +64,9 @@ async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry) -> boo
|
||||||
hass.config_entries.async_update_entry(
|
hass.config_entries.async_update_entry(
|
||||||
entry, data={**entry.data, CONF_REFRESH_TOKEN: refresh_token}
|
entry, data={**entry.data, CONF_REFRESH_TOKEN: refresh_token}
|
||||||
)
|
)
|
||||||
unload = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
unload = await hass.config_entries.async_unload_entry_platforms(entry, PLATFORMS)
|
||||||
if unload:
|
if unload:
|
||||||
|
hass.data[DOMAIN].pop(entry.unique_id)
|
||||||
if not hass.data[DOMAIN]:
|
if not hass.data[DOMAIN]:
|
||||||
hass.data.pop(DOMAIN, None)
|
hass.data.pop(DOMAIN, None)
|
||||||
return unload
|
return unload
|
||||||
|
|
Loading…
Reference in a new issue