I have been using HA with my Sonos to provide white noise for my bedroom. It was working great until Wednesday (2025-02-26). It plays the clip once (for 60m), but then stops. This is my automation:
My questions is 2 fold: 1) How can I make the repeat work again, and 2) Does anyone do something similar with white noise, and if so, how is it done so that it is reliable?
I recently tried to use repeat_set with my Sonos speakers (within the last week) and could not get it to work. I had never tried before.
You could enclose the media_play call in a repeat loop. But that means you won’t be able to easily stop playback from the Sonos device without additional code.
@d921 I can definitely try that, but I am afraid it will stop for a second and then start again, which will wake me up. I am a VERY light sleeper, which is why I need the white noise. Every sound the house makes, or the cat, or the dog wakes me up.
Note that if you’re okay with the limitation that you have to stop the automation using HA rather than using the Sonos app or the device physical toggles, you might (or might not) need a delay statement after the call to media_play. I cannot remember right now whether the media_play waits for the media to finish playing or not.
Good luck. Happy to help brainstorm how to fine-tune.
I re-read your earlier post about stopping for a second and then starting again. If you are really sensitive at that level of time–as opposed to, say, a minute–it’s going to be pretty hard to fine-tune the loop to avoid a pause. Was it truly continuous when you had repeat_set working?
An alternative might be to set the -delay time, assuming it needs to be used, to something shorter than the full length of the media file. I don’t know how much of a pause that would create, or if it would; nor whether that would be acceptable depending on how the white noise varies over time.
Anyway, I also suggest that you file a bug report with the Sonos integration, because it does feel like this is a bug, especially since it was working for you. Not clear if it was triggered by an HA update on your end or perhaps by a Sonos firmware update (or something else altogether).
Agreed. I am looking at some other options as well. It was continuous when I had repeat_set. I don’t know how that was even possible, but it was working great. I should probably make a shorter file (not 60m) so I can really test things. I will submit a ticket with the sonos integration and see what they say. Thanks for the idea!