How to stop additional ‘IF’ blocks running with the rest of the piston?


#1

hi @Robin

the piston has over 400 rows, so i copy a screenshot of the problem part.
if i say to alexa “…” , Alexa set the simulated switch “Alexa Kameras” to on and WebCore turn on all cameras.
If I start the routine later “Kameras aus”, so the switch “Alexa Kameras” is still on.
Row 319 - 328 is to resolve this. But the problem is, the Piston runs a second time.
because the if statement on 309 reacts.
How can I solve this? :slight_smile:


Clear a device variable or set initial
#2

I’ve moved your question out of the above thread (and into this new thread) as it’s a seperate question.

You should place the second ‘IF’ block inside an ‘on events’ block, so that it can run in it’s own little world, seperate from the rest of the piston.

on events from switch
IF
switch is on
do stuff


#3

Sorry,
i dont understand it completely. can you make a new try to describe your idea :slight_smile:


#4

Actually, scrub what I said above… just use a simulated momentary switch instead of a simulated toggle switch.

Then it will alaways reset to off ready for next execution of the routine and you won’t need your rows 319 - 328.


#5

thanks :slight_smile:
but i need the piston in two directions.
On AND Off :slight_smile:



#6

Why have simulated switches AND routines??

But if you insist on having both, let routines themselves do some of the legwork.

You can set the routine to be triggered by the switch changing to on and also tell it to turn that same switch on when the routine is triggered:

In webCoRE you just need to respond to the one thing… the routine executing… and you don’t need to worry about changing the switch value.