Thanks for the help. I will test it out today and let you know how it works.
Door Left Open Reminder - Configurable by Individual Contact
@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.
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
That is actually exactly what I did, but every time it runs, it gives the current time and not the time it opened.
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)
Ahhhā¦ That piston has no triggers
ā¦
How are you planning on detecting when the door opens if you are not subscribed to that event?
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)
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.
My apologies. I generally only have a single trigger
per pistonā¦
(Which allows for MUCH more elegant coding possibilities)
I appreciate the help, I usually do as well, trying something new here. I am 95% what I wanted, should be good enough.
@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.
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.
@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.
Pleaseā¦ by all means. I was probably out of line by trying to help in your thread, LOL
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.
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.
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.