Core: Sonos - Radio ('SoCo' object has no attribute 'is_radio_uri')

Created on 10 Apr 2020  路  13Comments  路  Source: home-assistant/core

I already removed my Sonos integration and added it newly.
When I select a Radio-Station from my Sonos-Favorites this message would appear:

('SoCo' object has no attribute 'is_radio_uri')

Environment

Standard Sonos Integration (Sonos Playbar)

  • Home Assistant Core release with the issue: 0.108.2
  • Last working Home Assistant Core release (if known): 0.107.x
  • Operating environment (Home Assistant/Supervised/Docker/venv): intel Nuc
  • Integration causing this issue: Sonos
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/sonos/

Problem-relevant configuration.yaml

n/a

Traceback/Error logs

AttributeError: 'SoCo' object has no attribute 'is_radio_uri'
2020-04-10 15:11:23 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.140198917118992] 'SoCo' object has no attribute 'is_radio_uri'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 134, in handle_call_service
    connection.context(msg),
  File "/usr/src/homeassistant/homeassistant/core.py", line 1232, in async_call
    await asyncio.shield(self._execute_service(handler, service_call))
  File "/usr/src/homeassistant/homeassistant/core.py", line 1255, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    self._platforms.values(), func, call, required_features
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 412, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 600, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 443, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 608, in async_select_source
    await self.hass.async_add_job(self.select_source, source)
  File "/usr/local/lib/python3.7/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 306, in wrapper
    return funct(*args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/components/sonos/media_player.py", line 327, in wrapper
    return funct(entity, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/components/sonos/media_player.py", line 885, in select_source
    if self.soco.is_radio_uri(uri):
AttributeError: 'SoCo' object has no attribute 'is_radio_uri'

Additional information

sonos

All 13 comments

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!

Hello - appears that this may be a problem only related with the Sonos Playbar. My other Sonos (Play5) seems to work okay.

Edit: not sure anymore if this has to do with the playbar. As soon as I'm using the media-player with a scene it seems that it's screwed up.

Here is the scene:

- id: '1586537095503' name: Radio entities: light.tv: brightness: 254 effect: none effect_list: - colorloop - random friendly_name: TV hs_color: - 60.314 - 74.902 max_mireds: 500 min_mireds: 153 rgb_color: - 254 - 255 - 63 state: 'on' supported_features: 63 xy_color: - 0.433 - 0.503 media_player.tv: friendly_name: TV source_list: - Live TV state: 'off' supported_features: 20413 media_player.wohnzimmer: entity_picture: /api/media_player_proxy/media_player.wohnzimmer?token=606ebf0f9dd2a651fef0bde0c2f4c22b67b5e0a44cedf479ecd35f63205b664d&cache=9165510134ebcb51 friendly_name: Wohnzimmer is_volume_muted: false media_artist: Dua Lipa media_content_id: x-rincon-mp3radio://https://live.antenne.at/as media_content_type: music media_title: Physical night_sound: false shuffle: false sonos_group: - media_player.wohnzimmer source: Antenne Steiermark source_list: - Antenne Steiermark - Diana Krall Radio - Fanfare - hochzeitsmusik - Lenny Kravitz-Radio - 脰3 Hitradio - Line-in - TV speech_enhance: false state: playing supported_features: 64063 volume_level: 0.06

That looks like your pysonos dependency didn't update properly. Try to remove your deps folder in the configuration directory and restart.

apparently this was a great hint - seems to work good now!
Thank you!!!

Awesome, thanks for confirming 馃憤

Hi @amelchio !
Not sure what happens - but this issue (above) happens quiet often (2 - 3 times a day) - especially when I'm switching to streaming radio.
Deleting the "deps" folder and restarting is a good workaround, but does not help permanentely - any idea?

Kind regards
Albert

Hmm are you using any custom components?

Yes - I use the mini-media-player, but will disable it for testing :)

That one should be okay. I was wondering about other integrations that could request the old pysonos version, for example I know there is an alarm integration in HACS.

Yes - good point - I'll deinstall the Sonos Alarm as well.
I appreciate you helping me troubleshoot this issue

Update - the message disapeard as soon as I uninstalled the Sonos Alarm addon (HACS).
Thank you for helping with this!

SonosAlarm should be fixed with the new release

Was this page helpful?
0 / 5 - 0 ratings