Fix deprecated asyncio.wait use with coroutines (#94371)

This commit is contained in:
Sebastian Muszynski 2023-06-11 20:01:41 +02:00 committed by GitHub
parent fd43687833
commit 2d62735b0d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 5 deletions

View file

@ -275,9 +275,7 @@ async def async_setup_entry(
if not entity_method:
continue
await entity_method(**params)
update_tasks.append(
hass.async_create_task(entity.async_update_ha_state(True))
)
update_tasks.append(asyncio.create_task(entity.async_update_ha_state(True)))
if update_tasks:
await asyncio.wait(update_tasks)

View file

@ -229,7 +229,9 @@ async def async_setup_entry(
if not hasattr(target_device, method["method"]):
continue
await getattr(target_device, method["method"])(**params)
update_tasks.append(target_device.async_update_ha_state(True))
update_tasks.append(
asyncio.create_task(target_device.async_update_ha_state(True))
)
if update_tasks:
await asyncio.wait(update_tasks)

View file

@ -500,7 +500,9 @@ async def async_setup_other_entry(hass, config_entry, async_add_entities):
if not hasattr(device, method["method"]):
continue
await getattr(device, method["method"])(**params)
update_tasks.append(device.async_update_ha_state(True))
update_tasks.append(
asyncio.create_task(device.async_update_ha_state(True))
)
if update_tasks:
await asyncio.wait(update_tasks)