[SOLVED] Execute two steps in a rule concurrently

This seems like it’s probably a pretty common requirement, so maybe I’m just missing something.

I’m creating a doorbell rule, which currently sets all of my Hue lights to ‘alert’ and plays doorbell.mp3 on my default audio sink - a Sonos speaker. However, I have two Sonos speakers, and would like the sound to play on both, simultaneously (or close-to simultaneously, I don’t mind a slight delay). I’ve found that if they’re grouped, then asking either one to play the sound plays on both, but I’d like it to work the same even if they aren’t already in a group.

The obvious option is:

playSound("sonos1", "doorbell.mp3")
playSound("sonos2", "doorbell.mp3")

but because the first call blocks until the MP3 has finished playing, the second one only starts about 20 seconds later.

So - my question is either: is there a way to ask the playSound action to target multiple audio sinks? Or - I guess more likely - is there a way to get each action to execute in a separate thread?

You could create a rule for each sonos. Both rules triggering on the same trigger but each one sends play to one sonos.

Have you ever tried to play the same radio station on two players which are not grouped? They will not play simultaneously! The same would be true for your desired setup. The “Sonos way” to play at the same time is grouping.
I’d use the rule to group them, play the bell and ungroup.

@job - thanks that’s exactly what I need to do - sorry, should have thought for a bit longer before posting!

@opus - agree that they won’t be simultaneous, hence my comment “or close-to simultaneously, I don’t mind a slight delay,” but for this case it doesn’t really matter. In the past, I’ve found grouping and then ungrouping is tricky because of the edge cases of trying to leave them in the same state they were before the rule triggered - so, if they were previously grouped, leave them grouped, otherwise ungroup them. Not so bad for 2, but what happens when I add a third? :slight_smile: