core: Sonos Restore reporting UPnP Error 402 received: Invalid Args from

The problem

(This appears to be related to https://github.com/home-assistant/core/pull/50575 , which fixed a similar issue quite awhile ago).

When using “sonos.restore” to bring back the state of a previously-backed-up Sonos entity, I am getting this error:

– Logger: homeassistant.components.sonos.speaker Source: components/sonos/speaker.py:1039 Integration: Sonos (documentation, issues) First occurred: 12:24:35 PM (1 occurrences) Last logged: 12:24:35 PM

Error on restore Main Room: UPnP Error 402 received: Invalid Args from 192.168.86.29

A few specific details:

  • This is a Sonos V2 system
  • This only happens when I’m playing from the Spotify app on my phone, with the Sonos system selected as output (if I launch the playlist from the Sonos app on my phone to the same Sonos system, things work perfectly).

What version of Home Assistant Core has the issue?

2022.8.5

What was the last working version of Home Assistant Core?

No response

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

config_entry-sonos-ea070f37f617c21e991b50d495b787b4.json.txt

Example YAML snippet

alias: Doorbell Pressed -> Chime on Sonos
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.front_door_button_pressed
    to: "on"
condition: []
action:
  - service: sonos.snapshot
    data:
      entity_id: all
      with_group: false
  - service: media_player.volume_set
    data:
      volume_level: 0.37
    target:
      entity_id: media_player.main_room_sonos
  - service: media_player.play_media
    data:
      media_content_type: music
      media_content_id: http://192.168.86.61:8123/local/doorbell_chime.mp3
    target:
      entity_id: media_player.main_room_sonos
  - delay:
      hours: 0
      minutes: 0
      seconds: 4
      milliseconds: 0
  - service: sonos.restore
    data:
      entity_id: all
      with_group: false
mode: single

Anything in the logs that might be useful for us?

No response

Additional information

No response

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 26 (4 by maintainers)

Most upvoted comments

As of 2023.5, the Sonos integration now has support for announce handling. Try to use media_player.play_media with announce: true or any TTS announcement when music is playing (even Spotify)–you no longer need to snapshot/restore/regroup.

As of 2023.5, the Sonos integration now has support for announce handling. Try to use media_player.play_media with announce: true or any TTS announcement when music is playing (even Spotify)–you no longer need to snapshot/restore/regroup.

Thank you @jjlawren - I can confirm this is indeed resolved (tested on 2023.6.1).

I’ve migrated everything over to the announce syntax per the docs which has enabled me to remove ~300 lines of ‘snapshot dance’ yaml from my scripts!!! Happy days! 🥳

This is a limitation of the Sonos API when working with Spotify (and certain other music services).

For (far) better Sonos alert/TTS handling, I’d currently recommend my Sonos Cloud custom component as mentioned above. I’d like to integrate these features into the standard integration eventually, but for now it’s separate.