diff --git a/custom_components/yandex_station/core/yandex_quasar.py b/custom_components/yandex_station/core/yandex_quasar.py index dff6152..04d38ef 100644 --- a/custom_components/yandex_station/core/yandex_quasar.py +++ b/custom_components/yandex_station/core/yandex_quasar.py @@ -525,11 +525,11 @@ async def get_voice_trigger(self, retries: int = 0): raw = await r.json() # 2. Search latest scenario with voice trigger - scenario = next( - s - for s in raw["scenarios"] - if s["trigger_type"] == "scenario.trigger.voice" - ) + for scenario in raw["scenarios"]: + if scenario["trigger_type"] == "scenario.trigger.voice": + break + else: + return # 3. Check if scenario too old d1 = datetime.strptime(r.headers["Date"], "%a, %d %b %Y %H:%M:%S %Z")