I’m running OH2 on my RPi3. I have a few Ecolink Intelligent Technology z-wave door sensors.
I have a rule that checks to see if the patio door ‘last tripped’ changed and then sends me a notification.
rule "Side Patio Door Opened"
when
Item SidePatioLastUpdate received update
then
logInfo("Side patio open", SidePatioStatus.state.toString)
pushover("Side patio Door activity")
end
My issue with the rule is that when the Pi restarts, the rule will trigger even when the door hasn’t opened in several days because it updates the ‘last tripped’ from NULL upon reboot:
LOG:
2018-09-24 08:33:55.932 [vent.ItemStateChangedEvent] - SouthPatioDoorLastTrip changed from NULL to 2018-09-22T13:27:32.000-0400
Is there a way to eliminate the false positive notifications with a better rule?
One option I could think of is to only perform the notification when the previousState is not NULL:
rule "Side Patio Door Opened"
when
Item SidePatioLastUpdate received update
then
logInfo("Side patio open", SidePatioStatus.state.toString)
if(SidePatioLastUpdate.previousState.state !== NULL){
pushover("Side patio Door activity")
}
end
YAY! Thank you all for your help! I got it to work correctly by using below:
rule "Side Patio Door Opened"
when
Item SidePatioStatus changed to OPEN
then
logInfo("Side patio open", SidePatioStatus.state.toString)
pushover("Side patio Door OPEN")
end
I don’t get the notifications on the reboot and I do get the notifications when I open the door!