In a triggered rule where there are more than one trigger that can fire a rule, how can I tell from the rule which trigger caused it to fire? I'd like to perform one extra task if the rule was triggered by the motion event compared to being triggered by the switch event.
That is, I'd like it to do:
If (motion event triggered the rule)
So action 1 would only be performed if triggered by motion but action 2 would be performed for any trigger event.
I could do it by checking the state of of the switch (if it's off, then it must have been the motion event that triggered it), but I'd like to know if I would be able determe which trigger fired the rule some other way.
However, what I really want to know is if there is a way to determine from the rule which trigger fired the rule and being able to use that information within the rule for different actions. I've got a rule in mind that potentailly would have 5 different triggers and it would be much easier if I could use some built in way of determining which one triggered the rule rather than rattleling of various IF statments just to determine that in a round-about way
Maybe use global variables.
If trigger A set GV A boolean to true reset to false after 5 seconds.
If trigger B set GV B boolean to true reset to false after 5 seconds.
Then use these variables in your rules.
Yes, but even with this I would have to first determine what triggered the rule. If this information is already available within the rule that would simplify things. I can of course easily do this in separate rules as well, but I'm trying to do this from just one rule.