Skip to content
Snippets Groups Projects
Commit 87d61eea authored by Esteban Zapata Rojas's avatar Esteban Zapata Rojas Committed by rospogrigio
Browse files

at init: Replace deprecated async entry setup call with suggestion.

Based on https://developers.home-assistant.io/blog/2024/06/12/async_forward_entry_setups/
it is possible to replace it with `async_forward_entry_setups` instead,
which accepts multiple platforms and it should be more efficient.
parent d2fa4dc2
Branches
Tags v5.2.2
No related merge requests found
......@@ -270,12 +270,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
)
hass.data[DOMAIN][TUYA_DEVICES][dev_id] = TuyaDevice(hass, entry, dev_id)
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_setup(entry, platform)
for platform in platforms
]
)
# Setup all platforms at once, letting HA handling each platform and avoiding
# potential integration restarts while elements are still initialising.
await hass.config_entries.async_forward_entry_setups(entry, platforms)
for dev_id in device_ids:
hass.data[DOMAIN][TUYA_DEVICES][dev_id].async_connect()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment