Switch emulated_hue to use async_timeout instead of asyncio.wait_for (#78608)

This commit is contained in:
J. Nick Koston 2022-09-17 01:34:44 -05:00 committed by GitHub
parent f59c8d985d
commit 5cde3ca4e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,6 +11,7 @@ import time
from typing import Any
from aiohttp import web
import async_timeout
from homeassistant import core
from homeassistant.components import (
@ -871,7 +872,8 @@ async def wait_for_state_change_or_timeout(
unsub = async_track_state_change_event(hass, [entity_id], _async_event_changed)
try:
await asyncio.wait_for(ev.wait(), timeout=STATE_CHANGE_WAIT_TIMEOUT)
async with async_timeout.timeout(STATE_CHANGE_WAIT_TIMEOUT):
await ev.wait()
except asyncio.TimeoutError:
pass
finally: