"NOT received command AND changed to ON"

Hi,

doe I have a possibility to get a trigger like above?

I need to catch an event when a switch changes state but did not receive any command.

Ist this possible?

Thanks a lot!

/KNEBB

No, a Trigger is suggested to start a rule. But you could use two rules, a proxy item and a timer:

Switch MyItem "Some Switch"
Switch MyProxy "only for rules"

and the rules:

var Timer tReset = null

rule "Set and reset Proxy"
when
    Item MyItem received command
then
    MyProxy.postUpdate(ON)
    tReset?.cancel
    tReset = createTimer(now.plusSeconds(2), [| 
        MyProxy.postUpdate(OFF)
    ])
end

rule "changed without command"
when
    Item MyItem changed
then
    if(MyProxy.state == ON) return; // cancel rule early
    // item has changed, but last command was minimum 2 Seconds earlier 
end
1 Like

Hi,

cool stuff!

I realized it by using a variable instead of a proxy item. Works like a charm!

Thanks for the idea!

/KNEBB