Skip to content

Commit

Permalink
Fix get_voice_trigger stop iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed Apr 5, 2024
1 parent a6bb37c commit f7ddc4a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions custom_components/yandex_station/core/yandex_quasar.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit f7ddc4a

Please sign in to comment.