SmartApp "Left it Open" modified for use multiple Contact Sensors

In case anyone is interested:
I have modified the “Left it open” smartapp, which warns if a door or window has been left open for a specified period of time.
In the original smartapp you can only select one sensor of a door or window. If you need to control more sensors, you have to create a new app for each sensor to control.
As I did not find another app to control several open sensors, it may exist, so I made a modified SmartApp “Left it Open-Multicontacts”:

  • You can select the door or window sensors you want to control from all the ones you have installed in your location.
  • A separate message is sent for each sensor when the set time is exceeded.
  • In the successive messages, if any contact is still open, the total time that each sensor has been open is reported.
    In the original smartapp, the message only reports that the time defined in settings was exceeded.
  • If a contact is closed, the time for that contact is reset, for the rest that remain open, its total counter continues adding.
  • Send a message confirming that “All selected sensors are closed now and the warning time is reset to the specified time”, when all selected contacts are closed after one or more have been open for longer than the setting time.
  • If all contacts are closed, everything is reset and it is waiting for any other “open” event
    Everything else remains the same as in the original smartApp.

You can see how the app works by following live logging in IDE

I put some screenshots and the smart app link:





5 Likes

Added for send a message confirming that “All selected sensors are closed now and the warning time is reset to the specified time”, when all selected contacts are closed after one or more have been open for longer than the setting time.

This is working well, thank you!

1 Like

I’ve always received the initial “Left it Open” notification from this app and always go ahead and close the door pretty quickly. Today was the first time the door was left open for an extended period of time, however, I did not receive the incremental notification (5 mins). Not sure why but I’ve increased the incremental to 10 mins and will see what happens.

It works well for me.
it may have to do with the server incident yesterday

1 Like

I have the app configured with text message notification as shown below. I always get the first notification five minutes in but any incremental notification is inconsistent. The other screenshot shows the two texts I received after a 39 minute gap. I’ve also tried the push notification option and again, I receive the first notification but nothing after. As a side note, I was having this issue on my OnePlus device. Over the weekend I switch carriers as well as got a new Galaxy S21 but still having the same issue.

I tried now with same intervals settings that you and work fine. See pictures.
Could be a problem with the Server in your zone
I don’t know what can happen.
Could you see live logging? you can check the “info log” blue label, that is the message.
the same thing happens to you with a different sensor?


Mariano, thanks for the response. I’ve opened the logger prior to opening the door and here is what I see. This started about an hour ago and the door is still open. I’m not good and deciphering this.

Ok, it error is assumed that a atomicState variable is not initialized.
I made a change and try it
The link is updated yet. Copy, save and publish.
Open SmartApp and rewrite the settings and save for update execute Code.

1 Like

Mariano, I tested a few times and after a few inconsistencies, things seem to be working well. Thanks for your help. I like the added touch of the message telling us the timer has been reset. Many thanks!

1 Like

Sorry for the error and thanks for reporting the malfunction :+1:

1 Like