home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.68k stars 30.81k forks source link

Sonos current_play_mode issues v2 #50433

Closed jjlawren closed 3 years ago

jjlawren commented 3 years ago

The problem

Uncaught exceptions are thrown:

Logger: homeassistant
Source: components/sonos/media_player.py:502 
First occurred: 5:18:08 PM (8 occurrences) 
Last logged: 7:02:43 PM

Error doing job: Future exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/sonos/media_player.py", line 502, in update_media
    variables["current_play_mode"] if variables else self.soco.play_mode
KeyError: 'current_play_mode'

Was intended to be fixed in #50386 but apparently this key isn't guaranteed to arrive in the event payload.

What is version of Home Assistant Core has the issue?

core-2021.5.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Sonos

Link to integration documentation on our website

https://www.home-assistant.io/integrations/sonos/

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

probot-home-assistant[bot] commented 3 years ago

sonos documentation sonos source (message by IssueLinks)

probot-home-assistant[bot] commented 3 years ago

Hey there @cgtobi, mind taking a look at this issue as its been labeled with an integration (sonos) you are listed as a codeowner for? Thanks! (message by CodeOwnersMention)

tangix commented 3 years ago

Could this be related to not being able to play anything on Sonos since upgrading to 2021.5.2? https://community.home-assistant.io/t/since-2105-00-i-can-no-longer-play-radiostations-on-sonos/306991/9 Everything else else (grouping, restoring, setting volume etc) works.

jjlawren commented 3 years ago

Could this be related to not being able to play anything on Sonos since upgrading to 2021.5.2? https://community.home-assistant.io/t/since-2105-00-i-can-no-longer-play-radiostations-on-sonos/306991/9 Everything else else (grouping, restoring, setting volume etc) works.

No, that's unrelated to this issue.

jjlawren commented 3 years ago

Tracked this down by auditing event payloads. Looks like most keys aren't included when there's a transport error similar to this check here: https://github.com/home-assistant/core/blob/48b5ef0bac6a8e9abc617ef62bb95f282548bb2d/homeassistant/components/sonos/media_player.py#L491-L497