Skip to content

Commit

Permalink
Fix glagol responses in some firmwares
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed Feb 29, 2024
1 parent 0e4acd1 commit c841341
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions custom_components/yandex_station/core/yandex_glagol.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,15 @@ async def _connect(self, fails: int):
if resp := data.get("vinsResponse"):
try:
# payload only in yandex module
card = (
resp["payload"]["response"]["card"]
if "payload" in resp
else resp["response"]["card"]
)
if "payload" in resp:
resp = resp["payload"]

if card:
if card := resp["response"].get("card"):
response = card
elif cards := resp["response"].get("cards"):
response = cards[0]
else:
response = resp["voice_response"]["output_speech"]

except Exception as e:
_LOGGER.debug(f"Response error: {e}")
Expand Down

0 comments on commit c841341

Please sign in to comment.