How can I play random Soundboard sound?


I have a door sensor that triggers a flow, and would like to randomly play a Soundboard sound of 3 specific sounds on my Sonos, how can I achive this? :slight_smile:

Best Regards

You can try this
And if a variable is 1 play audio 1, variable is 2 play audio 2 and if the variable is 3 play audio 3

I don’t use it myself.

Thank you Mike, that helps alot, at least I can get a random number to work with now … But I am not able, in the Flows to make a IF RandomNum = 1 THEN, ELSEIF RandomNum = 2 THEN, ELSEIF… so what would be the best approach for doing this in a flow?

How to work with ELSIF I have no idea at the moment.
But you can add 3 more extra flows. It is the most easy.
IF random nubber is 1
THEN start a flow Audio 1

Flow Audio 1
IF this flow is started
THEN play audiofile…

And so in for 2 and 3.

You can use it this way

  • Flow 0.4 Play 3 Sounds Random
    Contact alarm went on
    Logics: Calculate a numeric variable [RandomSoundSelected] as [RandomSoundN#]

  • Flow 1.4 Play 3 Sounds Random
    [RandomSoundSelected] has changed
    [RandomSoundSelected] is exactly 1
    Then play Sound1
    Start flow ‘2.4 Play 3 Sounds Random’

  • Flow 2.4 Play 3 Sounds Random

And so on


Thank you so much @Peter_Kawa that was exactly what I was looking for :partying_face:

1 Like