Door Left Open Reminder - Configurable by Individual Contact


#143

Thanks for the help. I will test it out today and let you know how it works.


#144

@bthrock Hello, how would I add the time of contact open to this. So when the push is sent it says door has been open since 8:30pm which is 30 minutes? It is the time of open that I cannot figure out how to do.


#145

I do not use this piston, but generally speaking:

IF Door's contact changes to open
Then
    Set variable {string} = $time
ELSE
    Set variable {string} = " "   <-- This clears the time when the door closes
END IF

IF another trigger happens
Then
    Send PUSH notification = "Door has been open since {string}"
END IF

#146

That is actually exactly what I did, but every time it runs, it gives the current time and not the time it opened.


#147

I cannot see what is stored in {doorsToCheck}, but keep in mind that every execution above will set a fresh new {timeOpened}. (line 47)

My advice was to set the variable only at the moment the door opens.
(not at every execution)


#148

Here is the whole thing, where would I put it? Line 61?


#149

Ahhh… That piston has no triggers

How are you planning on detecting when the door opens if you are not subscribed to that event?


#150

Same setup as in this post, 2 pistons, there is the Trigger piston.


#151

That one could partially work…

I mean, the $time will always be 2 minutes off, and will not properly set unless the Location is Disarmed… but it’s fairly close to your goal. (you could always +2 at a later time to find the precise time)


#152

so stick at line 27 and make it a global variable?


#153

Well…

You are tracking multiple doors here… but have them all sharing a single variable

This means each door opening will overwrite the previous times on all the other doors.


#154

ok, this is getting complicated, maybe I just go with the minutes opened, lol.


#155

My apologies. I generally only have a single trigger per piston…
(Which allows for MUCH more elegant coding possibilities)


#156

I appreciate the help, I usually do as well, trying something new here. I am 95% what I wanted, should be good enough.


#157

@wcmore I was curious, is it possible in the message expression to subtract the {timeOpenList[$device]} from $time ? If possible that would give me what I need.


#158

This was essentially what I was going to suggest when I read your original post this morning. I’m happy to help, but I don’t want to work with or through the modifications that have been suggested thus far. @WCmore’s advice is usually solid, but in this instance his lack of familiarity with the piston is complicating matters unnecessarily.


#159

@bthrock Thank you for helping. My 2 pistons are exactly as you have them in post #1. I have removed the 1 variable that I created. The only thing I have changed is the push notification to give me the minutes instead of the rounding you had.

I am not good with expressions at all, how would you do this?
The #s are set at 2 for testing only.


#160

Please… by all means. I was probably out of line by trying to help in your thread, LOL


#161

To display the time the door was opened the expression would be:

formatDateTime(addMinutes($time,-timeOpenList[$device]),“h:mm a”)

You can, of course, modify the time format as needed.

Also, with each of your PUSH notifications be sure to add “and store in messages” to maintain compatibility with the new ST app. Once you have it working you can, of course, modify or simplify the notifications section as needed.


#162

I’m generally happy for any help I can get because I don’t always have the time to jump in. You and I may have a few differences in how we approach some things, but usually end up in the same place. This time, however, when I started reading my eyes kind of popped open. :joy:

I’ve been meaning to post an updated version of this piston to reflect the changes needed for the new ST app and to simplify/declutter the notification section, but I keep getting dragged away elsewhere. Guess I’ll have to get on that now.