Multiple devices in one "With" action statement


#1

I put two different devices in a “With” statement like below and then used them to do different things (flash lights and speak via TTS). So I know it works. Obviously, the Island Light can’t use TTS, but the speaker can.

Is this the best approach, or should I separate my devices and actions into separate statements, e.g., keep the Island Light in one statement, the speaker in another? Any reason why I shouldn’t have three, four, or five devices in one “With” statement if I want to do a bunch of stuff after an event/trigger?

Is it better to separate them?

Thanks.

31 PM


#2

Depends if you want it to run one after the other (synchronous) or all at the same time (asynchronous).

Your above example will turn your audio on / off along with the light, and when finished flashing will perform the TTS.

Suggest separating the devices avoid flashing the audio device on/off.

Click on the first IF and go to its settings where you can choose asynchronous in order for the subsequent if to fire at the same time rather than waiting for the first to finish.


#3

DOH! :slight_smile: Thanks, totally forgot that the on/off might affect the speaker. Separated as you suggested.

Just when I began to think that I’m reading my pistons carefully… :smiley:


#4

It’s probably easier to debug also when you end up with a head-scratcher moment :slight_smile: