Then If Statement


#1

How does Then If work? I want to setup a scenario whereby If presence changes to present THEN IF front door changes to open turn lights on.

Will it work? Or do both triggers need to happen at the same time for this to work?


(Eric) #2

Then-If
This is a dual piston, because it supports two conditional sets. It allows for one conditional set to allow a second conditional set to be evaluated only if the first one was true.

Format:
IF (conditions1) THEN (actions1) THEN IF (conditions2) THEN (actions2) ELSE (actions3)
State:
The state of the Then-If piston is deemed TRUE if both (conditions1) and (conditions2) evaluate as true, or FALSE otherwise

Actions:
The (actions1) are executed if (conditions1) is true, (actions2) are executed if both (conditions1) and (conditions2) are true, (actions3) are executed if either (conditions1) or (conditions2) is false

Don’t think of them as order of the events happening. It’s more like it checks the first condition then it checks the second condition, but only if the first condition is true.

http://thingsthataresmart.wiki/index.php?title=CoRE#Then-If


#3

So how can I achieve what i am trying to do? What should I use?


(Eric) #4

Using webCoRE… Something like this should work…