Sonos S1 speakers suddenly gone mute

I have 5 older S1 compatible Sonos speakers, and three newer S2 compatible Sonos (Symfonisk) speakers that have all been playing relatively nicely together under HA. (Using the Sonos app(s) is a different matter - and I try really hard not to if at all possible!)

These speakers have been providing my TTS automation feedback for several years without enough trouble to talk about.

Last week I was away interstate for work, and at some point while I was gone my broadband modem’s plug pack power supply had a minor altercation with the head of a vacuum cleaner down below my study desk, resulting in my internet connection going down, and the main switch that joins the various segments of my network being offline. After a couple of days like this, I got a call from home explaining that nothing was working - and step by step diagnosed the modem issue. Plugging it back in got it all working again - or so I though…

On returning home I discover that all my S1 Sonos speakers will no longer play any TTS messages at all. All the Symfonisk S2 speakers are working perfectly. While the S1 speakers won’t talk - they are still on-line and everything else (streaming audio, playing locally stored files, alarms etc) is working fine. Just no TTS.

I don’t thinks it is related, but did notice when I installed Music Assistant 8 or 9 months ago - all my media-player devices (which includes the S1 and S2 speakers) got duplicated. I now have media-player.office and media-player.office_2 for example. They all got duplicated. Music Assistant only seems to want to work with the _2 version of anything, but the other services were happy to use the original definition. So I just left it like that.

Now, when I manually execute a scrip that should play a TTS message - the trace tells me that the script has completed normally - just nothing gets said.

I have found the following in the Logs - but don’t know enough to get any useful information out of it, beyond the fact that the first occurrence was while I was away - and the number of occurrences is plausibly how many announcements might have been made in the intervening period…

Logger: homeassistant
Source: components/sonos/media_player.py:559
First occurred: September 15, 2024 at 11:18:07 AM (95 occurrences)
Last logged: 7:16:08 PM

Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 707, in _async_run
    return await self.script.async_run(script_vars, context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1795, in async_run
    return await asyncio.shield(create_eager_task(run.async_run()))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1296, in async_run
    await super().async_run()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 463, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 527, in _async_step
    self._handle_exception(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 557, in _handle_exception
    raise exception
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 525, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 763, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 726, in _async_run_long_action
    return await long_task
           ^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2761, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2804, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 996, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1068, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/tts/__init__.py", line 460, in async_speak
    await self.hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 2761, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2804, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 996, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1068, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sonos/media_player.py", line 559, in async_play_media
    raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Announcing clip http://xxx.xxx.xxx.xxx:8123/api/tts_proxy/e4e8bc0de6792691c8a5cb4e9d5bc05430d95bac_nl-nl_-_tts.piper.mp3 failed {'namespace': 'audioClip:1', 'playerId': 'RINCON_B8E93788A26E01400', 'response': 'loadAudioClip', 'success': False, 'type': 'globalError'}

Is anyone able to move me any closer to a solution?

Many thanks in anticipation.

That issue should be fixed in 2024.9.2

Thanks Pete - I’m actually running 2024.9.3 and the issue is still happening. If I recall correctly, it was probably on 2024.9.2 when the plug pack and vacuum cleaner had their little “conversation”.

I fixed that problem. Double check you are actually on that version.

If it’s not working, please create a GitHub issue, attach the integration diagnostics files and a home assistant log with debug turned on for the Sonos integration.

Hi Pete,

Absolutely certain about the version number. Not convinced it has anything to do with the integration however…

Before figuring out how to generate/download diagnostic logs etc, though I’d try what is within my immediate grasp first. Removed Music Assistant from the system and got rid of all the _2 media player references.

Under testing I now find some of the S1 speakers work sometimes and have not yet found a consistent set of circumstances to predict when it will work and when it wont.

I have a great many automatons that call TTS messages, but have a script for each media player. So the automation sets a text message in a text helper, then calls the script for the required media player, which in turn reads the text and passes it to the TTY system targeting that media player device. I’ll copy a sample of one of these scripts below.

The trace for the script is now telling me the TTS service is not supported on the media player?!? It has been working for years so this really confuses me. Apart from removing Music Assistant the only other update that has been loaded in the last few days was for Chime-TTS, which I’m not actually using in the scripts at the moment.

alias: Speak in Living Room
sequence:
  - condition: state
    entity_id: input_boolean.announcements
    state: 'on'
  - action: media_player.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: media_player.living_room
  - data:
      entity_id: media_player.living_room
      with_group: true
    action: sonos.snapshot
  - data:
      volume_level: 0.5
    target:
      entity_id:
        - media_player.living_room
    action: media_player.volume_set
  - data:
      entity_id: media_player.living_room
      message: '{{ states("input_text.text_to_say" ) }}'
    enabled: false
    action: tts.picotts_say
  - data:
      cache: true
      media_player_entity_id: media_player.living_room
      message: '{{ states("input_text.text_to_say" ) }}'
    target:
      entity_id: tts.piper
    enabled: true
    action: tts.speak
  - wait_for_trigger:
      - platform: state
        entity_id:
          - media_player.living_room
        to: paused
    timeout:
      hours: 0
      minutes: 0
      seconds: 15
      milliseconds: 0
  - data:
      with_group: true
      entity_id: media_player.living_room
    action: sonos.restore
mode: queued
max: 10
icon: mdi:speaker-message

If I use the Media Player card in Lovelace for the same media player device, and use Select Media to choose the TTY source - it works just fine. My logic says the media player either is or isn’t TTS compatible - it can’t change of the basis of where the text is coming from - so the cause must be something else. I also can’t understand why something that has been working for years should suddenly become such a problem…

Sorry - I might have figured out at least a part of that.

was something I needed for the _2 version of the media player which kept falling asleep. The native version doesn’t do that - so I just deleted that command, and that particular script started working again.

I think I added the wake up command to all the scripts. Will go and delete them all again now and see what happens.

“Power failure” was definitely a red herring. And the fact the integration had the same issue previously was also unrelated.
It was a Combination of factors, included the difference between S1 and S2 Sonos, and how Music Assistant interacted with them - plus some extra code I put in my automatons to try to deal with the Music Assistant vagaries, plus not remembering to reverse those changed with I uninstalled Music Assistant. MA is gone now, and everything is working perfectly again. It never really did what I wanted anyway.