core: Error when calling Sonos websocket: Connection timed out
The problem
Effectively the same problem as the original issue in https://github.com/home-assistant/core/issues/92570 - I’ve read through the networking steps and by all accounts I have the right ports open; I’m running HA in docker host mode on a Synology NAS that allows all local networking in the firewall. My Sonos speakers are all on the same subnet/vlan as the NAS.
What’s weird is if I copy the yaml for the automation action and run it in the “services” panel it works no problem. If I run the action itself in the automation, also works fine. And that’s the case everytime I notice the log message and try retesting.
I’m playing the TTS on a Sonos group with an Arc, Sub, and 2 Era 300s.
What version of Home Assistant Core has the issue?
2023.6.1
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Container
Integration causing the issue
Sonos
Link to integration documentation on our website
https://www.home-assistant.io/integrations/sonos/
Diagnostics information
I’ve enabled debug logging, will add when the issue next happens.
Example YAML snippet
service: media_player.play_media
data:
announce: true
media_content_id: media-source://tts/cloud?message="Someone is at the door"
media_content_type: music
target:
entity_id:
- media_player.living_room_sonos
continue_on_error: true
### Anything in the logs that might be useful for us?
_No response_
### Additional information
_No response_
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 21 (4 by maintainers)
It will be in 2024.2.
This was annoying me tonight, for me, on my old play:1 units, if they’re already playing something, the web socket connection appears to take more than 3seconds to iniitalise itself. (This is tested from a client separate from my home assistant server.)
I’ve submitted a PR to the underlying sonos_websocket library to allow for providing a tunable connection timeout parameter, as when I tune it to 6 seconds (the default is 3) the chance of a successful web socket connection nears 100%, but at 3s it was closer to 20% success rate. If this gets accepted, routing it through to the home assistant core code will allow those of us experiencing this behaviour to be more accepting of the connection timeout should we want to be.
Here’s the logs as promised:
#94687 Same issue here