Explicitly create_task for asyncio.wait (#46325)

This commit is contained in:
Anders Melchiorsen 2021-02-20 19:57:46 +01:00 committed by GitHub
parent cf69415272
commit 9f4874bb81
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -181,7 +181,10 @@ async def async_setup(hass, config):
return
await asyncio.wait(
[script_entity.async_turn_off() for script_entity in script_entities]
[
asyncio.create_task(script_entity.async_turn_off())
for script_entity in script_entities
]
)
async def toggle_service(service):

View file

@ -629,7 +629,7 @@ async def entity_service_call(
# Context expires if the turn on commands took a long time.
# Set context again so it's there when we update
entity.async_set_context(call.context)
tasks.append(entity.async_update_ha_state(True))
tasks.append(asyncio.create_task(entity.async_update_ha_state(True)))
if tasks:
done, pending = await asyncio.wait(tasks)