Alert when door sensor is tripped, then wait 2 minutes before alerting again


#62

I was suggesting a hard coded solution for a set number of notifications.

The following basic structure may look primitive, but I find it to be more customizable, with zero chance of an infinite loop.

IF Door’s contact stays open for 121 sec  <-- Trigger
Then 
    Send first notification  (friendly reminder)
    Wait 2 minutes
    IF Door’s contact is open             <-- Condition
    Then 
        Send second notification  (slightly aggressive)
        Wait 2 minutes
    END IF
    IF Door’s contact is open             <-- Condition
    Then 
        Send third notification  (stress the urgency)
        Flash (centrally located light) briefly
        Wait 5 minutes   (notice I changed this)
    END IF
    IF Door’s contact is open             <-- Condition
    Then
        Send fourth notification  (Get off your butt!)
        Flash one light in each of the main rooms
        Voice Alert (Alexa/Google/Sonos etc)
        Wait 5 minutes
    END IF
    IF Door’s contact is open             <-- Condition
    Then
        Send fifth & last notification  (slowly drags index finger across throat)
        Turn on one light in every room
        Send Urgent SMS to home owners
    END IF
END IF

Pro Tip:

The last block can also send a SMS to a trustworthy neighbor… In case the logic gets that far down in the code without the door closing. (although I would not add that code during testing, LOL)


#63

This seems to work!

I only did 4 cycles and I’ll have to work on the Alexa integration, haven’t ventured that far yet.
Nor did I see a way to add my ST plug in outlet as an action. I see LIFX listed. Would I need to call another Piston?

Thanks,

Dave


#64

Lookin’ good!!


I must have missed that part of the conversation… What is your plans with that device?
(It’ll probably go in one of the pistons we just made)


#65

You mentioned flashing lights. I have a Smartthings plug-in outlet that my office lamp is on. Didn’t see how to add a line to flash it.

I have the Alexa Smartapp added, just haven’t looked for any examples yet.


#66

Ahh ok… If you don’t have any smart bulbs, then the best flash might be simply:

Turn on
Wait 2 secs
Turn off


Here is how I get Alexa to give me voice alerts.
(takes 20-30 min to setup, but only 2 seconds for all future voice alerts)


The good news is, with the above structure, you can add more commands to it as your house gets smarter.


#67

I still don’t see where to add reference to the light. If I click on new task say below “Send PUSH notification” the only thing close is execute piston. I don’t see the option to interact with a device directly at that level?


#68

Inside the appropriate block, click on:

+ add a new statement > Add an action > then choose your outlet > add a task > select a command

The rest should be familiar…


#69

got it, I was looking at the + add a new task above it, thinking the + add a new statement was outside of the current action…I think keeping the nesting straight is my biggest challenge.

Thanks,


#70

I think I understand what happened. If you closed the door and reopened it before the 2 minute timer was up, it likely interrupted the piston and the Boolean never got set back to false, would need to add protection for that case. I would suggest adding another trigger like this to the end of the piston:

If contact sensor changes to closed
Then
    Set door_opened=false
    Cancel all pending tasks
End if

#71

The door open/close pistons have been working, however as of a few days ago my push alerts have been delayed. I’m talking over a minute later I receive the alert.

I’ve tried rebooting the hub and it’s still randomly delayed.

Is this a Smartthings issue or something to do with Webcore or both?

Does Webcore run locally on Smarthings or does it still have to go to the cloud to run?

I’ve recently been looking into Home Assistant and I’m seriously considering moving to it so everything runs locally. Anyone have any experience with it?

Thanks,


#72

This is not normal. Can you share the piston that is sending delayed PUSH notifications?


Side Note:

If all of your pistons are sending delayed PUSH notifications, then rebooting your cell phone can make a big difference. (since that is the device that receives the PUSH)


#73

Rebooting didn’t fix it but it did lead me to test a bit deeper. Turns out I only had the old ST app alerting (store messages set to false) from when I was testing and the app somehow got set to go to sleep. I turned sleep off and flipped the flag to true so I get all the alerts within a second or two.

How I just have to figure out what’s up with my Meross Garage door authentication. Support is useless. Starting with the last ST upgrade my authentication drops out every few days and I have to re-authorize it.

Any comments about Home Assistant?

Thanks for the help.


#74

Now what would really be cool is if I could get different alerts for each action played by my phone.

Door opens - Door open/close sound

Garage opens - an announcement that the garage door has opened or some other recognizable sound.


#75

If your phone is Android, then Tasker can do all of that, plus so much more!

(without a doubt, it was the best $3 I spent in the past decade)


#76

I’ll check it out.

Thanks!


#77

If you end up going with the Tasker approach, I would also recommend installing a free “media grabber” like Zedge to download cool sound effects. If you can deal with their ads, their search is phenomenal…

(Notifications are usually short, while Ringtones are usually longer in duration)

Once you have the sound effects downloaded to your phone, then Tasker can call those sounds effects whenever ‘X’ happens.


#78


So I am looking at this again…If I understand this code correctly, this is a brilliant solution for avoiding loops.

If the door stays open for 121 seconds, then execution will cascade down this piston (top to bottom) with each successive IF and WAIT, sending an alert, waiting, and then moving to the next IF/WAIT and sending a more aggressive alert. If the door closes, then the current WAIT is cancelled and the piston is executed from the top again. This time, the door is closed, and execution is completed. So the TCP could be left at default for each WAIT.

Am I understanding this correctly?


#79

Thanks!


Absolutely… I might even go as far to say that it should be left at default.

(here is that full post for reference)


Pro Tip:

You will probably not want to add more triggers to this piston though…


#80

It all looks very complicated, really. The first thing I would do in such a situation is to look for a good solution. I don’t understand this, so I don’t buy an input alarm sensor without support. For my café, I bought a sensor a year ago, which only infuriated me. The alarm went off for no reason, and when it was necessary, it didn’t work. As a result, my café was broken into and everything was broken. This company didn’t want to talk to me at all, which drove me crazy. I found another company that a friend told me about. There I purchased an entrance alarm sensor. I liked the fact that the product can be returned within 30 days and the support service is working (I checked). So far, everything is fine, I’m happy, my business is protected.


https://www.1800doorbell.com/entrance-alerts/.