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
74.16k stars 31.14k forks source link

Playing Spotify URIs with the Sonos integration fails with UPnP Error 800 #42538

Closed ismarslomic closed 4 years ago

ismarslomic commented 4 years ago

The problem

After successful upgrade to HA 0.117.0 I tried to use the new support for playing Spotify URIs with the Sonos integration by using the media_player.play_media service. I got two Sonos One (Gen 2) and one Sonos Go speakers that where already integrated in HA, and none of those managed to play Spotify playlist. Error I keep receiving in Logs is Error on play_media with UPnP Error 800 received: from 192.168.0.14. Im also experiencing the issue by using the Spotify Playlist Link and Spotify URI.

Service call from Developer Tools:

service: media_player.play_media
  data:
    entity_id: media_player.sonos_stue_1
    media_content_id: 'https://open.spotify.com/album/1bt6q2SruMsBtcerNVtpZB'
    media_content_type: music

Environment

Problem-relevant configuration.yaml

default_config:

homeassistant:
  name: My HA
  time_zone: Europe/Oslo
  unit_system: metric
  external_url: "https://my.personal.url"
  internal_url: "http://192.168.0.2:8123"

# Text to speech
tts:
  - platform: google_translate

spotify: 
  client_id: ****
  client_secret: ****

Traceback/Error logs

Logger: homeassistant.components.sonos.media_player
Source: components/sonos/media_player.py:475
Integration: Sonos (documentation, issues)
First occurred: 11:23:13 PM (1 occurrences)
Last logged: 11:23:13 PM

Error on play_media with UPnP Error 800 received: from 192.168.0.14

Additional information

probot-home-assistant[bot] commented 4 years ago

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

springstan commented 4 years ago

@amelchio could you please take a look at this issue since it seems to be related to #41366? Thanks :+1:

amelchio commented 4 years ago

Silly question but did you install Spotify as a service on the Sonos speakers? I get that error if I remove the service in the Sonos app ...

(Also, please remember to uninstall the beta custom integration that I now you tried at one point)

ismarslomic commented 4 years ago

Yes, Spotify as a service is installed in the Sonos (s2) app and I just performed "Reauthorize Account". And yes, I have removed Sonos (Beta) integration from HACS. Im happy to help out on solving this issue, so please let me know if you need more details or have any suggestions on what I can try out.

amelchio commented 4 years ago

To proceed, I would probably need a network capture while starting a Spotify track from the native app.

Are you by any chance using Sonos beta software?

ismarslomic commented 4 years ago

No Sonos Beta software. So you would like to see network log while starting Spotify song from my Sonos mobile app?

crosbyh commented 4 years ago

I am experiencing this same issue on my instance. I never installed the beta version from HACS, just upgraded to 0.117.1.

Regular commands such as volume, play/pause, and switching sources to "My Sonos" favorites all work as normal.

When I attempt to play a Spotify URL or URI to Sonos, my logs show:

Error on play_media with UPnP Error 800 received: from 10.0.1.x

I'm happy to assist with troubleshooting as well, would love to get this working!

amelchio commented 4 years ago

I looked into this, it seems that multiple different Spotify services exist and we need to handle each one differently. To get a bit closer, can you both tell me:

ismarslomic commented 4 years ago
crosbyh commented 4 years ago

I am using:

amelchio commented 4 years ago

Thanks. I am on Premium but not Family so it seems like that could potentially be an issue. If anyone is reading along, feel free to share more working/non-working configuration details.

Is anyone comfortable doing a wireshark/tcpdump of the communication that the official app does?

crosbyh commented 4 years ago

I can do that if provided some guidance on the process.

RonSpawnson commented 4 years ago

Also experiencing this. Amelchio directed me here to share info about my setup. Let me know if you would like additional details.

amelchio commented 4 years ago

I made a new beta-008 that I think takes care of the US issue but I am not so sure about Family.

It can be installed as a custom repository (integration) with HACS: https://github.com/amelchio/sonos ... can someone please test?

If it still does not work with Family, I will sign up and see what's different.

ismarslomic commented 4 years ago

It works!!!!! Just installed beta-008 and it worked immediately! Thanks a lot!

amelchio commented 4 years ago

Thank you, that is a nice surprise. I will add it for the 0.118 beta then.

crosbyh commented 4 years ago

I installed the beta integration as well and it fixed the issue on my US Premium Family plan. Thank you!!