core: Sonos Media Browser raises unknown error when browsing favorites

The problem

When I press on the “Favorites” folder in the sonos media browser, an unknown error is displayed and the following is added to the log:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 27, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 1179, in websocket_browse_media
    payload = await player.async_browse_media(media_content_type, media_content_id)
  File "/usr/src/homeassistant/homeassistant/components/sonos/media_player.py", line 698, in async_browse_media
    return await media_browser.async_browse_media(
  File "/usr/src/homeassistant/homeassistant/components/sonos/media_browser.py", line 124, in async_browse_media
    return await hass.async_add_executor_job(
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/sonos/media_browser.py", line 374, in favorites_payload
    media_content_type = SONOS_TYPES_MAPPING[group_type]
KeyError: 'object.container'

What version of Home Assistant Core has the issue?

2022.2.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

sonos

Link to integration documentation on our website

No response

Diagnostics information

config_entry-sonos-93060e60bd1ab5107ce9239e127235da.json.txt

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (9 by maintainers)

Most upvoted comments

@jjlawren

@nielsaust what you’re describing is different from what’s going on here. I’d try power cycling the problem speaker and to create a separate issue if you can’t figure out the problem.

It was and I appologize for cluttering this thread with it. I did try a powercycle and it didn’t fix it first, but another try and it did, so thanks! I’ll go now 😉

Got it. Either way the linked PR should allow you to browse safely, even if not every favorite will show up.

Thanks, that lets me reproduce your issue (and no, nothing was translated by Sonos on my side).

This might be a bit tricky to completely support these podcasts as the method to browse them via the API isn’t immediately clear to me. I can avoid the error, but you will not see be able to browse them for the time being.