Simplified Piston


#1

1) Give a description of the problem
Hi, my piston works fine but i know it can be simplifed. My Webcore skill level is low but i’m learning

2) What is the expected behaviour?
so i have multiple IF blocks, each one tells Echo to say something different dependant on which door sensor is open. Is this possible without multiple IF blocks. Eg if sensor 1,2,3,4 or 5 is open then do Echo Voice command 1,2,3,4 or 5 depending on the door sensor which is open

3) What is happening/not happening?
As above

(upload://vkKPEwTA67HXhaJIX4FQ5KJRHdp.png)

5) Attach logs after turning logging level to Full
(PASTE YOUR LOGS HERE THEN HIGHLIGHT ALL OF THE LOGS AND CLICK ON THE </> ICON TO FORMAT THEM CORRECTLY)

REMOVE BELOW AFTER READING
If a solution is found for your question then please mark the post as the solution.


#2

First thing you can do is create a variable of the device type where you can add all of the contact sensors. Next is just refer to that device variable in your piston so you don’t have to specify if each one is open.


#3

Also, you’ll probably want a ~5 sec WAIT after each spoken command… This is in case multiple doors are open, webCoRE will know to pause long enough for the earlier speech to finish before continuing.


#4

Hi, yeah I’m fine with with the variable. However i want each open sensor to make Echo say a slightly different thing.


#5

If the contact names are named like how you have them in the piston, you can probably just send the whole variable to Echo Speaks and it will be announced as…

"It's raining and the patio doors, utility doors and kitchen windows are open." assuming they’re all open. Some expression work can be done to make the grammar better I guess if you’re picky about that :slight_smile:

Edit: I forgot to mention that you’ll need another device variable to store matching devices in. Meaning any devices whose contacts are open when the piston is triggered. That’s the device variable that you want Echo Speaks to announce.