I want to get an alert if a door has been open for a defined period of time.
Has someone already solved for this, if so pls tell me so I dont re-invent the wheel?
If not then I am open to developing this (not a profesional coder but have dabbled in the past).
I have got my door sensor (ST Multisensor) hooked up to the Artik Cloud so I get alerts now for ‘Door Open’ and ‘Door Closed’ - so - need an application that monitors time between two events and when it exceeds a defined theshold it generates an alert.
Whats the easiest way to do this? Can python be used? Is there a non-coding way to achieve this?
You shouldn’t need to go through the Artik cloud to do that. The SmartThings sensor is a native device to the SmartThings hub so you can just use the SmartThings platform.
I suggest you take a look at core. That’s a very sophisticated Community created rules engine. It can do many layers of conditionals including the use case you describe.
The code is available in the author’s thread:
There is also a peer assistance thread for help in setting up pistons (core calls each individual rule a “piston”). If you browse that thread you’ll also see many examples of use cases there.
So I think you’ll find core can do everything you want. Although if I’I’ve misunderstood and you wanted to write code in the Artik cloud itself to include data from other devices, then you might need a different approach, which is why I’ve moved this thread to the developers section. But if you’re just staying within the SmartThings platform, core should be sufficient.
In future, you might also find the quick browse lists in the community – created wiki helpful for finding existing code. (The community here is great, but the forum search feature is not always helpful.)
In this case, for example, look in the smart app section at the list for “alerts and notifications” and you’ll find several choices there that might work. Since you do have a programming background, I thought I’d go ahead and mention Core first as it gives the most options although its complexity can be daunting to nonprogrammers.
Smart Home Monitor (the built-in security app) has a custom monitoring setting that does exactly what you’re referring to. I use it to notify me when:
My freezer or fridge have been open for more than 2 minutes
My front door or back door have been open for more than 1 minute
My main garage door has been open for more than 5 minutes
There is any activity at all at the mailbox (metal mailbox, and my hub doesn’t always receive the “closed” notification. I’d switch to a plastic mailbox, but for the HOA).
Anything more complex than that, I use CoRE. For example, my third-car garage, where the kids keep their bikes, is set to:
Automatically close after 5 minutes.
Check again after 1 minute to see if it’s closed (say, if the kids blocked the beam or something)
Push a notification that it’s still open and attempt to close again every 1 minute until it’s closed.
Edit: Unless I missed a subtlety in there about the term “notify” and you’re wanting to send events to another system. You can still use SMH for that, though. Create a virtual switch that SMH turns on whenever your rule is tripped, and use that virtual switch to drive your notifications, IFTTT, whatever.