From 5cde3ca4e17caafa8f120c3b40d4639cab6b9d4c Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 17 Sep 2022 01:34:44 -0500 Subject: [PATCH] Switch emulated_hue to use async_timeout instead of asyncio.wait_for (#78608) --- homeassistant/components/emulated_hue/hue_api.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/emulated_hue/hue_api.py b/homeassistant/components/emulated_hue/hue_api.py index 687a7d5fbe6..272645909a5 100644 --- a/homeassistant/components/emulated_hue/hue_api.py +++ b/homeassistant/components/emulated_hue/hue_api.py @@ -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: