Sonos announcment doesn't work anymore

Hi

For some reason the announcement feature for sonos stoped working and I can’t figure out why. Here ist the script:

announce: true
extra:
  volume: 20
media:
  media_content_id: /local/Soundeffects/announcement.mp3
  media_content_type: music
  metadata: {}

if I remove the “announce” part it works. If not, I get the error message:

Error when calling Sonos websocket: Unexpected response received: 503, message=‘Invalid response status’, url=‘wss://192.168.1.44:1443/websocket/api’

The log file doesn’t help me either:

2025-10-16 17:39:39.750 ERROR (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Error executing script. Error for call_service at pos 1: Error when calling Sonos websocket: Unexpected response received: 503, message='Invalid response status', url='wss://192.168.1.44:1443/websocket/api'
2025-10-16 17:39:39.750 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140598046547040] Error handling message: Error when calling Sonos websocket: Unexpected response received: 503, message='Invalid response status', url='wss://192.168.1.44:1443/websocket/api' (home_assistant_error)

The HA Server is in an other Subnet (192.168.2.x) where all my IoT devices resides with limited internet access (with exception of the HA server of corse), but that wasn’t an issue until now. And as mentioned, playing media in general isn’t a problem.

Can someone push me in the right direction to find the error?

Thanks in advance!

No one got an idea? It’s quite annoying, since I was heavily reliant on the announcement feature.

Hi,

I can just confirm i’m experiance the same problems using the announcement.

Example:

2025-10-22 20:35:49.999 ERROR (MainThread) [homeassistant.components.automation.hoveddoren_er_aben] Hoveddøren er åben: Error executing script. Error for call_service at pos 1: Error when calling Sonos websocket: Unexpected response received: 503, message='Invalid response status', url='wss://10.43.101.4:1443/websocket/api'
2025-10-22 20:40:32.994 ERROR (MainThread) [homeassistant.components.automation.hoveddoren_er_aben] Hoveddøren er åben: Error executing script. Error for call_service at pos 1: Error when calling Sonos websocket: Unexpected response received: 503, message='Invalid response status', url='wss://10.43.101.4:1443/websocket/api'

Using configuration as:

action: media_player.play_media
metadata: {}
data:
  media:
    media_content_id: >-
      media-source://tts/tts.google_translate_da_dk?message=Hovedd%C3%B8ren+er+%C3%A5ben&language=da
    media_content_type: audio/mp3
    metadata:
      title: Hoveddøren er åben
      thumbnail: https://brands.home-assistant.io/_/google_translate/logo.png
      media_class: app
      children_media_class: null
      navigateIds:
        - {}
        - media_content_type: app
          media_content_id: media-source://tts
        - media_content_type: audio/mp3
          media_content_id: >-
            media-source://tts/tts.google_translate_da_dk?message=Hovedd%C3%B8ren+er+%C3%A5ben&language=da
      browse_entity_id: media_player.kokken_h
  announce: true
target:
  area_id: kokken

The Sonos devices is running version 17.1 (build 85.0-65270)
And the devices that have the problem is Sonos Roams both gen 1 and 2.

However the cable connected ones Beam, and Play Ones does indeed work as expected like:

2025-10-22 21:37:20.113 DEBUG (MainThread) [homeassistant.components.sonos.media_player] Playing http://10.43.10.171:8123/api/tts_proxy/V1-RvZo9MvRLQVm6GnvvAw.mp3 using websocket audioclip
2025-10-22 21:37:20.113 DEBUG (MainThread) [sonos_websocket.websocket] Sending command: [{'namespace': 'audioClip:1', 'command': 'loadAudioClip', 'playerId': 'RINCON_542A1B89A41001400'}, {'name': 'Sonos Websocket', 'appId': 'com.jjlawren.sonos_websocket', 'streamUrl': 'http://10.43.10.171:8123/api/tts_proxy/V1-RvZo9MvRLQVm6GnvvAw.mp3'}]
2025-10-22 21:37:20.113 DEBUG (MainThread) [sonos_websocket.websocket] Websocket connection reset, will try again
2025-10-22 21:37:20.114 DEBUG (MainThread) [sonos_websocket.websocket] Opening websocket to wss://10.43.101.1:1443/websocket/api
2025-10-22 21:37:20.223 DEBUG (MainThread) [sonos_websocket.websocket] Successfully connected to wss://10.43.101.1:1443/websocket/api

Best Regards
Thomas

Strange as of today its working, without any changes done.
It seems to be a random timed problem.


2025-10-26 14:02:26.897 DEBUG (MainThread) [homeassistant.components.sonos.media_player] Playing http://10.43.10.171:8123/api/tts_proxy/URfUAcsN3FMnGUoj8J7x3g.mp3 using websocket audioclip

2025-10-26 14:02:26.898 DEBUG (MainThread) [sonos_websocket.websocket] Sending command: [{'namespace': 'audioClip:1', 'command': 'loadAudioClip', 'playerId': 'RINCON_C43875C3D9FA01400'}, {'name': 'Sonos Websocket', 'appId': 'com.jjlawren.sonos_websocket', 'streamUrl': 'http://10.43.10.171:8123/api/tts_proxy/URfUAcsN3FMnGUoj8J7x3g.mp3'}]

2025-10-26 14:02:26.898 DEBUG (MainThread) [sonos_websocket.websocket] Websocket connection reset, will try again

2025-10-26 14:02:26.898 DEBUG (MainThread) [sonos_websocket.websocket] Opening websocket to wss://10.43.101.4:1443/websocket/api

2025-10-26 14:02:26.976 DEBUG (MainThread) [sonos_websocket.websocket] Successfully connected to wss://10.43.101.4:1443/websocket/api

2025-10-26 14:02:26.976 DEBUG (MainThread) [sonos_websocket.websocket] Sending command: [{'namespace': 'audioClip:1', 'command': 'loadAudioClip', 'playerId': 'RINCON_C43875C3D9FA01400'}, {'name': 'Sonos Websocket', 'appId': 'com.jjlawren.sonos_websocket', 'streamUrl': 'http://10.43.10.171:8123/api/tts_proxy/URfUAcsN3FMnGUoj8J7x3g.mp3'}]

2025-10-26 14:02:27.016 DEBUG (MainThread) [soco.events_asyncio] Event 289 received for ZoneGroupTopology service at 1761483747.0169754

Yes, I power cycled all my Sonos speaker yesterday (which was quite tiresome, since I hid the power cables and sockets quite well) and it seems to work now too. Sonos just seems unstable at the moment.