Conditions and Triggers: The difference?

difference
faq
conditions
triggers

#13

There is also this snippet of information from @ady624 that you may find useful for additional clarification.
_____________________________________
A piston is usually executed on events that trigger it. Therefore, triggers - by definition - will always run pistons. In the event no trigger is present, conditions then fulfill that role by acting as triggers themselves (all the conditions in the piston do that when no triggers are present). The moment a trigger exists, conditions step down and act as just that, conditions (or restrictions, if you want), therefore not triggering pistons themselves.

Only conditions >>> all conditions act as triggers and they all subscribe to events
Mixed conditions and triggers >>> only the triggers subscribe to events
Only triggers >>> only the triggers subscribe to events

There is, of course, the manual modification of this behaviour, by forcing a condition or trigger to either subscribe regardless, or never subscribe. Those settings take priority over the logic described above.


Piston reading stale door sensor value when triggered by a timer?
#14

Very nice write up and good info.

Idea for enhancements

  1. Use an icon or other visual to mark triggers and conditions.
  2. Warning if you have triggers in a piston but have a if statement contained therein that has only conditions or other dead end builds.

BRB going to review all of my pistons.


#15

thank you.

this is sort of there on the piston view page. the lightning bolt to the left of the condition will tell you if its subscribed to an event. but yes, does not show in edit mode.

well you could legitimately have if conditions where it does not involve any triggers, even though the piston got fired by receiving an event from another if condition which has triggers. :slight_smile:


#16

Brilliant thread.


#17

An important point … It’s worth noting that you can have more than one trigger in your IF though if you are using OR instead of AND. Of course the same holds true that you still will not have more than one trigger that is TRUE but you can put more than one trigger in the same IF.


#18

thank you. funny that even as you were quoting that para i was also slightly modifying it. still keep it simple for new users without infringing on technical correctness. :slight_smile:

let me know what you think of this new version of the para. keep it or revert back?

EDIT: edited the para slightly.


A piston for the morning is failing by going off at night
#19

I think that works :+1:.


#20

sorry, but would you please review one more time? edited slightly :slight_smile:


#21

No worries. I saw the update. All good in my opinion.


#22

thanks @Nezmo. it stays then :slight_smile:


#23

I’m still a bit confused about 2 things:

1)WHAT is a trigger?
2)WHAT is a condition?


#24

when editing a condition, the kind of comparison defines if it is a condition or trigger.


Piston reading stale door sensor value when triggered by a timer?
#25

OK so a condition is just the state of something, where a trigger is an action to something.


#26

Heres goes my noob question.

I have 2 motion sensors and a single dimmer. My desired logic is for the light to turn On when any of the sensors is active… so that’s easy since its and OR the piston executes when either sensor activates as expected.

Problem comes when motion stops. I want the light to turn Off when there no movement on BOTH sensors. Instinct tells me to do the same as the On part but using AND instead of OR… but from what I’ve read here that won’t work.

How can I make the light turn off when both sensors are deactivated (no motion).


#27

Instead of making two different conditions, select both motion sensors and then you can choose ALL or ANY. So for turning them on you would select ANY. For the part turning them off you would select ALL.


#28

Ok ok… so no matter how many devices are selected it still counts as a single condition?


#29

That is correct


#30

Just tried but it doesn’t work. Can I PM you or is it OK to paste my current code on this thread?


#31

Thanks for your time, Really appreciate it… It’s working and I learned something today.


#32

Great thread guys! I have a couple of questions to better understand the piston building process:

  1. Does the order matter within a piston of the trigger and conditions to make a piston work correctly? It would seem as though triggers should always come first in a piston or does it matter, both in the piston actually working properly and for overall efficiency?

  2. Very curious when folks keep talking about efficiency in pistons, what are they really speaking of? Is it efficiency that I, the user, will actually see in terms of lights turning on faster when events trigger, or just general stuff in my part of the WebCore world happening faster for me - or are we speaking in terms of server efficiency in the background, but not necessarily stuff I can ‘see’? (i.e. more efficient pistons from everyone x1000’s of users will help reduce the overall server requirements of the system) ?