Sonos snapshot restore stopped working

I have a few TTS scripts that use with my Sonos. They’ve been working perfectly for months. Starting with 2021.3.x, they stopped. My script works by:

  • snapshot all devices (I have 9)
  • Join 8 of them
  • Set the volume
  • Announce “Dinner!”
  • restore all devices

Nothing gets restored now. I’m left with 8 devices all joined and the dinner wav file in last played.

Again, these scripts worked perfectly for months, but they stopped working with 2021.3.x. I saw in some previous posts that adding delays could help. I tried that but no dice.

What happened?

Same here. I see an error suddenly.

Invalid config for [script]: [sonos_say] is an invalid option for [script]. Check: script->sonos_say. (See /config/configuration.yaml, line 12).

I had to add quotes to media_player.attic_sonos on my wait_template:

wait_template: "{{ is_state(‘media_player.attic_sonos’, ‘playing’) }}“

Didn’t need quotes before, but I guess you do now.

alias: Sonos TTS script
sequence:

  • service: sonos.snapshot
    data:
    entity_id: ‘{{sonos_entity}}’
  • service: sonos.unjoin
    data:
    entity_id: ‘{{sonos_entity}}’
  • service: media_player.volume_set
    data:
    entity_id: ‘{{sonos_entity}}’
    volume_level: ‘{{volume}}’
  • service: tts.google_translate_say
    data:
    entity_id: ‘{{sonos_entity}}’
    message: ‘{{message}}’
  • delay: ‘00:00:05’
  • service: sonos.restore
    data:
    entity_id: ‘{{sonos_entity}}’
    mode: single

The issue seems to be around : - service: tts.google_translate_say

Bumped in to the same problem with the Sonos not restoring it original state after TTS message has been played. It appears to be holding the TTS string and not restoring. Pressing the play button on the Sonos Play 3 gets the message repeated and the message is shown with a hex label in the speakers buffer when viewed via Sonos app.
The TTS is triggered by my Axis camera as perimeter monitor and Heron defence system on my pond, so I need it to be responsive and don’t want to build too many delays in to it. This was my first project with Hassio 6 months ago and it worked initially but not reliably now.

I am a nube and was wondering if there any new solution or is the “{{” syntax the answer or at least what syntax I might I be missing over the last three months ?

NOTE: Restore only failing when restoring to “TuneIn” stream. No problem when running Sonos from NAS and music is loaded in to Sonos Entity buffer. If the buffer is empty sometimes it remains populated by TTS message.

I have used Sonos AudioClip TTS Add-on for grouped TTS announcements for a while, but it stopped working recently (potentially due to the recent changes to the Sonos back-end.
Thats why I have re-activated my old automation, which simply calls a script to announce, with a fixed time out before restoring the previously snapshot group configuration

Sonos TTS Script
say:
  alias: Sonos TTS
  sequence:
    - action: sonos.snapshot
      data:
        with_group: yes
        entity_id: "{{ where }}"
    - action: media_player.unjoin
      data:
        entity_id: "{{ where }}"
    - action: media_player.join
      data:
        entity_id: "{{ master }}"
        group_members: "{{ where }}"
    - action: media_player.volume_set
      data:
        entity_id: "{{ where }}"
        volume_level: "{{ volume }}"
    - action: tts.google_translate_say
      data:
        entity_id: "{{ master }}"
        message: "{{ what }}"
    # Delay before restoring the initial snapshot should be set depending on the length of the message
    - delay: "00:00:09"
    - delay:
        seconds: 1
    - wait_template: "{{ is_state(master, 'paused') }}"
    - action: sonos.restore
      data:
        with_group: yes
        entity_id: "{{ where }}"```

However the group created for the announcement seems to stick, even when the previous played tune in station resumes playing.