I have an MP3 file that’s one repetition of a siren. I’d like to start it playing and have it continue to loop until I stop it. I’ve tried just playing the file as well as putting it in a play list and playing that. Each time it just plays it once and stops.
Just figured I’d keep the whole topic in this thread. Currently if my alarm goes off I play a short piece of siren noise that loops on and on until the alarm is disarmed. My problem is that once that happens, if I push the play button the next time I’m in one of those rooms then I get the siren instead of whatever the last playlist I had going.
Didn’t I read that there is some way to do an alert noise for just this case? If I do it that way can I still do the looping?
I see no solution if you have replaced your current queue with a siren noise file.
In the past, you could have used the actions RestorePlaybackContext and SavePlaybackContext to save and restore the playback context including the queue. But I finally suppressed the restore of the queue as it could take ages to execute for users having very large queue.
One alternative would be to not replace the queue (when playing your siren noise) but simply use the action Alert with a duration. But that would require that you know the duration of your disarming process.
That sounds workable. So if I do an Alert action for say… 2 minutes… And then I end up disarming the alarm in one minute. Can I do a ‘stop’ or something that would stop the blaring and then the queue would still be there?
Normally the Alert action does not affect the queue content. But that is to be checked again, in case Sonos has changed something in the recent version.
If you stop yourself the siren file, you will loose what was the current title and position in the title in the queue that was playing. Here you can use SavePlaybackContext just before playing your siren file and call RestorePlaybackContext when your alarm is disarmed. It will restore the playback exactly at the repivous position before the siren noise.
In fact, you don’t need to call Alert but just call PlayURI.
Here is the scene when starting the noise file:
call SavePlaybackContext
call PayURI to start the playback of your noise file
lolodomo, I can’t seem to find any documentation on the SavePlaybackContext and RestorePlaybackContext. I’m going to give it a try myself, but was hoping you could point me to a code example.
Thanks
Pasqual
Best Home Automation shopping experience. Shop at Ezlo!