Core: Sonos select source empty list

Created on 4 Apr 2019  Â·  20Comments  Â·  Source: home-assistant/core

HASS Info:

arch | x86_64
dev | false
docker | true
hassio | true
os_name | Linux
python_version | 3.7.2
timezone | Europe/Rome
version | 0.90.2
virtualenv | false

Last working Home Assistant release (if known):
0.90.2

Component/platform:
https://www.home-assistant.io/components/sonos/
https://www.home-assistant.io/components/media_player

Description of problem:

From this morning (Europe) I have an empty list in "select_source" service in my Sonos Speakers.
It was working yesterday showing a list matching "Sonos Favorites" and "Sonos Playlists". My wakeup scripts are in place from more than a year. No errors logged in home assistant

Additional information:

I have received a mail yesterday by Sonos that requires me to approve a privacy agreement to enable the new feature "Recently Played"
https://en.community.sonos.com/announcements-228985/sonos-version-10-1-now-available-recently-played-6822569

This agreement seems to affect someway the data stored in Sonos regardin my playlists and favorites. Maybe the update has moved this information in the cloud and is no more available locally on the controllers.

sonos

Most helpful comment

I should make it clear that this was fixed (will be in version 0.92).

Meanwhile, deleting those favorites that are not playable but rather containers should avoid the problem.

All 20 comments

Ditto; just about to post an issue myself (already post over at the subreddit).

I suspect the same – I believe the 'recently played' feature has restructured the source list which has broken the API.

I ran into same issue, and was able to get it partially working by removing everything except Albums from my Sonos favorites. Not a perfect solution, but made my use case work. It also implies that it's probably not a hopeless case.

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

Same issue on my End, kids alarm did not go off :(, my mourning routine was hectic.

Just when I thought Homeassistant was now stable for me on my PI lol.

system info.

arch | armv7l
-- | --
dev | false
docker | true
hassio | true
os_name | Linux
python_version | 3.7.2
timezone | Indian/Mauritius
version | 0.91.0
virtualenv | false

Currently my Sonos speakers are on firmware 10.1 it looks like this could be the culprit :(

Same issue here, only visible source is Line-in:
"source_list": [
"Line-in"
],
media_player.select_source only works on "Line-in"

Sonos Play 5:
Version: 10.1 (build 49263270)

Hass.io
arch x86_64
dev false
docker true
hassio true
os_name Linux
python_version 3.7.2
timezone Europe/Stockholm
version 0.91.0

So, I've just noticed this in the logs when restarting HA:

/home/administrator/.homeassistant/deps/lib/python3.6/site-packages/pysonos/services.py:675: FutureWarning: The behavior of this method will change in future versions.  Use specific 'len(elem)' or 'elem is not None' test instead.

Reason? 🤔

I do not use this feature (select source) myself so I am actually not completely sure how it used to work.

That said, I have now updated some of my players to Sonos 10.1 and activated Recently Played and I do not see this problem. My players on 10.0 as well as those on 10.1 show my _Sonos Favorites_ (not _Sonos Playlists_) as available sources. This includes:

  • local music library albums
  • local music library artists
  • Spotify albums
  • Spotify playlists
  • a TuneIn radio station

I expect the issue to be related to some other type of item that can be stored as a favorite. If someone affected can run this and paste the output, that could be helpful:

virtualenv --python=python3 sonossources
source sonossources/bin/activate
pip install pysonos
python -c 'import pysonos; print(pysonos.discovery.any_soco().music_library.get_sonos_favorites())'

(you can delete the sonossources directory afterwards)

@amelchio would love to help you out, However I have no idea how to run the Above command under hassio :(

@cnc79 you can run it on any machine where you can use python.
I will try it in the evening and post results.

@cnc79 you can run it on any machine where you can use python.
I will try it in the evening and post results.

thx :)

I opened the sonos app on my mac, there was a new favourite called "Spotify My Music" or something like that, which I didn’t recognise. I removed this favourite, rebooted HA (may not have been necessary), and voila....sources are visible again!

Tried the same thing, removed ”radios from tunein”, then the source list got back again.
Maybe it has something to do with specific object types in the favorites list. I will test som more when i get back home.

Do you have any idea how these items got added?

Also, before everybody deletes their culprit, please first run my above commands so we can get the integration fixed :-)

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/temp/sonossources/lib/python3.6/site-packages/pysonos/music_library.py", line 165, in get_sonos_favorites
    return self.get_music_library_information(*args, **kwargs)
  File "/temp/sonossources/lib/python3.6/site-packages/pysonos/music_library.py", line 316, in get_music_library_information
    items = from_didl_string(response['Result'])
  File "/temp/sonossources/lib/python3.6/site-packages/pysonos/data_structures_entry.py", line 52, in from_didl_string
    item = cls.from_element(elt)
  File "/temp/sonossources/lib/python3.6/site-packages/pysonos/data_structures.py", line 496, in from_element
    DidlResource.from_element(res_elt))
  File "/temp/sonossources/lib/python3.6/site-packages/pysonos/data_structures.py", line 175, in from_element
    raise DIDLMetadataError('Could not create Resource from Element: '
pysonos.exceptions.DIDLMetadataError: Could not create Resource from Element: protocolInfo not found (required).

@amelchio , this is the output I get from running your commands, but not sure if this is an exception on the command itself failing? Running this from an Ubuntu server (not the same machine as Hass.io is running from).

@elbogi That is exactly what I need. Thanks 👍

Do you have any idea how these items got added?

Also, before everybody deletes their culprit, please first run my above commands so we can get the integration fixed :-)

Dont know if it got added automatically, because i cant recall adding any new favorites in a long time.
I tried it again, and if i open the windows app for Sonos, go to "Radio from TuneIn"->Right click on "My Radiostations" and "Add to favorites", the "Source-list" stops working.
If i remove this favorite from the favorites list, the "Source-list" starts working again.

Maybe it can have something to do with "My Radio stations" contains multiple Radio channels, so it is an array in an array sort of :/

Best Regards,
Rehnmark

@rehnmarkse Awesome, I managed to reproduce the issue by doing that (using the iOS app). That will make it much easier to fix.

@amelchio Great! :)

I should make it clear that this was fixed (will be in version 0.92).

Meanwhile, deleting those favorites that are not playable but rather containers should avoid the problem.

I should make it clear that this was fixed (will be in version 0.92).

Meanwhile, deleting those favorites that are not playable but rather containers should avoid the problem.

Just installed 0.92 confirmed its working again :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ofuangka picture ofuangka  Â·  3Comments

aweb-01 picture aweb-01  Â·  3Comments

TheZoker picture TheZoker  Â·  3Comments

coolriku picture coolriku  Â·  3Comments

arangates picture arangates  Â·  3Comments