[SOLVED] The rule triggering cause


I have a rule which is triggered by cron job (time) and by item event. When rule is fired, I want to know what is the triggering cause (time / item event).

Is there a way to know it?


I think I found an answer here

I think:

rule "Test"
    Time cron "1 0 0 ? * * *" or
    Item myItem changed
    if (triggeringItem !== null) {
        // Rule triggered by Item
    } else {
        // Rule triggered by cron
1 Like

Get rid of the . name on the first if statement or the rule will throw an exception saying that null doesn’t have a .name method when the rule is triggered by the time trigger.

1 Like