Fridge Open Door Notification Help


#1

1) Give a description of the problem
(I have created a Piston to alert me if my fridge has been left open for more than five minutes. It works and alerts me. When I open the door I see Webcore start a five minute timer. The problem is, if I open the fridge again, say with 10 seconds remaining on the timer, the piston triggers. I thought I could of solved this saying “if the sensor remains unchanged.”, but that does not solve it. I though then to write an exit command for the piston saying if I closed the fridge door, to exit the piston. That also did not solve it. I am sure this is simple, but I am missing something. )

2) What is the expected behaviour?
(I need the door closing to stop the five minute count down. )

3) What is happening/not happening?
(Piston works, but if I open the door when timer is still running and timer runs out I get a trigger. )

**4) Post a Green Snapshot


#2

First, “Stays Unchanged” does not work. (it’s unfinished code)
I would remove that line

Second, “Stays Open for 5 min” does work, albeit, a bit strange. I usually insert STAYS in a piston where only a single device / single attribute is subscribed to. It works very well in that scenario.

Third, it is important to remember that any device attributes that we subscribe to
(in this case, Device1’s contact, Device2’s contact, Device3’s contact)
will run the entire piston, from top to bottom, on each and every change.
(door opens OR closes)

There is no way to prevent that from happening. If you subscribe to an attribute, then any changes to that attribute will execute the entire piston.


#3

Thanks.

So these contacts are all part of the same device, just different doors.

I did update the line of code. Is there any work around I could consider outside of just extending the time it takes to trigger? It’s a problem when putting groceries away or when cooking sometimes. Maybe an “else if” where door state changes to closed and then a wait is executed buying me more time?


#4

My apologies… When I said single “device” above, I meant single smart device… not single appliance.


#5

So maybe I should try separating out the devices?


#6

If you want the timer for one STAY to not be affected by another smart device changing, then I agree. If they are in the same piston, then each action starts all over at the top.


#7

There is also the lazyman’s way…

IF any of DeviceA, DeviceB, or DeviceC changes        <-- Trigger
Then 
    Wait 5 minutes
    IF any of DeviceA, DeviceB, and DeviceC are open  <-- Condition
    Then 
        Send SMS
    END IF
END IF

Notice the trigger does NOT mention open or close. Doing either will reset the timer.


One warning with this method… Lets say

12:00 DeviceA opens
12:04 DeviceB opens
12:08 DeviceC opens
12:12 DeviceC closes
12:16 DeviceB closes

your alert will come in at 12:21. (5 min after last action, and only because A is still open)


#8

Thank you again! I think this is more inline with what I was thinking. I have some lighting triggers where the trigger and the condition are nested into the same if block. It worked there, so I figured doing that would work here. I think the breakdown in my logic is that in this instance, the piston doesn’t go back to check the condition in the if block because of the top down execution. I need to make sure the condition is checked after the trigger, as you state.