Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on media_player.select_source for Sonos speakers - UPnP Error 402 #117703

Closed
ljsquare opened this issue May 18, 2024 · 10 comments
Closed

Error on media_player.select_source for Sonos speakers - UPnP Error 402 #117703

ljsquare opened this issue May 18, 2024 · 10 comments
Assignees

Comments

@ljsquare
Copy link

The problem

When selecting a source with with service media_player.select_source, you get an UPNP error 402

What version of Home Assistant Core has the issue?

core-2024.5.4

What was the last working version of Home Assistant Core?

core-2024.4

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Sonos

Link to integration documentation on our website

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

Diagnostics information

No response

Example YAML snippet

service: media_player.select_source
target:
  entity_id: media_player.sonos_move
data:
  source: LOS40

Anything in the logs that might be useful for us?

No response

Additional information

No response

@home-assistant
Copy link

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)

@ljsquare
Copy link
Author

ljsquare commented May 18, 2024

Addition:
When using media_player.play_media you'll get this error:
Error calling SonosMediaPlayerEntity._play_media on media_player.sonos_move: UPnP Error 714 received: Illegal MIME-Type from ipaddress

snippet yaml:

service: media_player.play_media
target:
  entity_id:
    - media_player.sonos_move
data:
  media_content_id: LOS40
  media_content_type: music

@PeteRager
Copy link
Contributor

PeteRager commented May 18, 2024

That looks like an invalid media content Id. What are you trying to do exactly?

When I run that service call, I get the same error. The error is from Sonos and indicates that the content_id is of an unknown type. So the integration appears to be working as expected when passing in invalid media

@PeteRager
Copy link
Contributor

@home-assistant close

@ljsquare
Copy link
Author

ljsquare commented May 19, 2024

I'm trying to start my radio (LOS40 is a Spanish radio station). It has worked in earlier versions.

But also when I use the favourite_id, as written in the docs , I get this error: Error calling SonosMediaPlayerEntity._play_media on media_player.sonos_move: UPnP Error 402 received: Invalid Args from

snippet:

service: media_player.play_media
data:
  media_content_id: FV:2/0
  media_content_type: favorite_item_id
target:
  entity_id: media_player.sonos_move

@PeteRager
Copy link
Contributor

PeteRager commented May 19, 2024

Select Source does allow the playing of a favorite by name, so that should work. As should play media using the favorite id (the example you provided is not quoted the same as in the documentation, try putting those strings in quotes)

There is error checking in select source that would log a different error if the favorite does not exist. That isn't happening, so it appear the favorite does exist but the speaker is refusing to play it. UPNP errors are coming from the speaker which means the integration is sending it but the speaker is rejecting it.

  • double check the favorite still exists in the Sonos App
  • Are you able to play it from the Sonos app?
  • Try power cycling the speaker.
  • Try deleting the favorite in the Sonos app, re-adding and restart HA
  • Provide the text content of the Sonos favorite entity (grab it from developers tools)

@PeteRager
Copy link
Contributor

@home-assistant reopen

@home-assistant home-assistant bot reopened this May 19, 2024
@PeteRager
Copy link
Contributor

I just tried this on the dev branch (aka the latest). I added that radio station to my sonos favorites and tried these two service call. They both work fine.

service: media_player.select_source
data:
  source: LOS40
target:
  entity_id: media_player.living_room

and i tried it using the favorite id (my id may be different than yours)

service: media_player.play_media
target:
  entity_id: media_player.living_room
data:
  media_content_type: "favorite_item_id"
  media_content_id: "FV:2/16"

@ljsquare
Copy link
Author

Select Source does allow the playing of a favorite by name, so that should work. As should play media using the favorite id (the example you provided is not quoted the same as in the documentation, try putting those strings in quotes)

There is error checking in select source that would log a different error if the favorite does not exist. That isn't happening, so it appear the favorite does exist but the speaker is refusing to play it. UPNP errors are coming from the speaker which means the integration is sending it but the speaker is rejecting it.

  • double check the favorite still exists in the Sonos App
  • Are you able to play it from the Sonos app?
  • Try power cycling the speaker.
  • Try deleting the favorite in the Sonos app, re-adding and restart HA
  • Provide the text content of the Sonos favorite entity (grab it from developers tools)

It works from the Sonos App and I already power cycled the speaker.
I'll try to delete the favourite in the Sonos app and try it again.

@ljsquare
Copy link
Author

The problem lays with the new Sonos app. Old favourites won't work either in the sonos app or HA. When deleting the old one and creating a new favourite, it works like it should be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants