Skip to content

Commit

Permalink
at init: Replace deprecated async entry setup call with suggestion.
Browse files Browse the repository at this point in the history
  • Loading branch information
rospogrigio committed Jul 29, 2024
1 parent 24863ae commit 55e1ce3
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions custom_components/localtuya/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ def _device_discovered(device):
device = hass.data[DOMAIN][TUYA_DEVICES][dev_id]
if not device.connected:
device.async_connect()

elif dev_id in hass.data[DOMAIN][TUYA_DEVICES]:
# _LOGGER.debug("Device %s found with IP %s", dev_id, discovered_ip)

Expand Down Expand Up @@ -273,12 +274,9 @@ async def setup_entities(discovered_ids):
)
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 discovered_ids:
hass.data[DOMAIN][TUYA_DEVICES][dev_id].async_connect()
Expand Down

0 comments on commit 55e1ce3

Please sign in to comment.