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
71.03k stars 29.69k forks source link

Sonos integration can't play radio stations (TuneIn) #122204

Closed Tazmanian79 closed 1 month ago

Tazmanian79 commented 1 month ago

The problem

I can't play 'another' TuneIn radio station anymore. It used to work till 2 days ago but now when I select another Radio station it gives an error. However it can still play TuneIn Radio's, because when I don't change the Radio and it has a TuneIn Radio selected I can just hit play and it starts playing.

However when I select (even the same radio) it gives the error: Kan service media_player/play_media niet aanroepen. Error calling SonosMediaPlayerEntity._play_media on media_player.living: UPnP Error 402 received: Invalid Args from IP

I have the same issue on 2 different Home Assistant installations.

Upgrade to 2024.7.3 does not solve it.

What version of Home Assistant Core has the issue?

core-2024.7.2

What was the last working version of Home Assistant Core?

core-2024.7.2

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

Diagnostics information

Logger: homeassistant.components.websocket_api.http.connection Bron: components/websocket_api/commands.py:241 integratie: Home Assistant WebSocket API (documentatie, problemen) Eerst voorgekomen: 22:10:34 (1 gebeurtenissen) Laatst gelogd: 22:10:34

[140168302994784] Unexpected exception Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/sonos/helpers.py", line 60, in wrapper result = funct(self, *args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/sonos/media_player.py", line 566, in _play_media self._play_favorite(favorite) File "/usr/src/homeassistant/homeassistant/components/sonos/media_player.py", line 454, in _play_favorite soco.play_uri(uri, title=favorite.title, timeout=LONG_SERVICE_TIMEOUT) File "/usr/local/lib/python3.12/site-packages/soco/core.py", line 146, in inner_function return function(self, *args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/soco/core.py", line 839, in play_uri self.avTransport.SetAVTransportURI( File "/usr/local/lib/python3.12/site-packages/soco/services.py", line 207, in _dispatcher return self.send_command(action, args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/soco/services.py", line 515, in send_command self.handle_upnp_error(response.text) File "/usr/local/lib/python3.12/site-packages/soco/services.py", line 571, in handle_upnp_error raise SoCoUPnPException( soco.exceptions.SoCoUPnPException: UPnP Error 402 received: Invalid Args from 10.52.0.174

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 241, in handle_call_service response = await hass.services.async_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2731, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2774, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 999, in entity_service_call single_response = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1071, in _handle_entity_call result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/sonos/media_player.py", line 550, in async_play_media await self.hass.async_add_executor_job( File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/sonos/helpers.py", line 74, in wrapper raise SonosUpdateError(message) from err homeassistant.components.sonos.exception.SonosUpdateError: Error calling SonosMediaPlayerEntity._play_media on media_player.living: UPnP Error 402 received: Invalid Args from IP

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 1 month ago

Hey there @home-assistant/core, mind taking a look at this issue as it has been labeled with an integration (websocket_api) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `websocket_api` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign websocket_api` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


websocket_api documentation websocket_api source (message by IssueLinks)

home-assistant[bot] commented 1 month ago

Hey there @jjlawren, @peterager, mind taking a look at this issue as it has been labeled with an integration (sonos) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `sonos` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign sonos` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


sonos documentation sonos source (message by IssueLinks)

PeteRager commented 1 month ago

That errors means the station is unrecognized by Sonos, try deleting the favorite and recreating.

Tazmanian79 commented 1 month ago

It was related to TuneIn I had to re-approve the connection between TuneIn and the Sonos app.

I also removed all favorites and added them again. All is working again now.

Except one small issue. There are still 3 stations in HA even when all favorites in the Sonos app are deleted. Reloading the integrations is not helping. How can I remove the 3 stations?

PeteRager commented 1 month ago

Try restarting HA, some info may not get cleared on an integration reload.

Tazmanian79 commented 1 month ago

after a restart the 3 stations that are removed are still there.

PeteRager commented 1 month ago

The integration does not store this information, which means the favorites are coming from one of your speakers. You may have to power cycle the speakers.

Tazmanian79 commented 1 month ago

I power cycled all speakers, restarted HA but 3 stations that I removed are still there .... Don't know how to solve this. They are not in the Sonos app anymore.

sof5ms commented 1 month ago

I had the same issue and I think it was the combination of the old TuneIn Integration in Sonos an the new Sonos App, which was deployed some weeks ago. What I have done is: Re-added all my favorite Radio Streams, but via "Sonos Radio" integration this time I think it should also work to use the "NEW TuneIn" Integration in the Sonos App. (It's calls "new" inside the Sonos App) It was not possible to delete all old, non working, existing TuneIn favorites. So I used the Linux Desktop App "Noson" to do this. With the desktop app it was no problem to delete all the orphaned entries. (I think it should work with the Sonos Desktop App for Windows, too.) Now it is all fine within the Sonos App and within HA. Perhaps that helps...

Tazmanian79 commented 1 month ago

@sof5ms thanks. I installed the windows app and that showed indeed the 3 stations that were not working anymore. Was able to delete it, everything is fine now

PeteRager commented 1 month ago

Glad it is sorted out

PeteRager commented 1 month ago

@home-assistant close