Notify when someone is at the door at a certain time

(Lance) #1

I’m wondering if there is a way to set the acceleration detection (knock sensor) on my front door to only notify me at a certain time. There is a notify me app available but I would like an option added to be able to set “only at certain times” This should be added permanently to the notify me app. Thanks

(Brian) #2

Only way I can think of this is create a mode that is active during these hours and have the notify me app only alert you when that mode is active. Alternatively you can customize the notify me app to add the time logic.

(Lance) #3

Thanks doc! The mode switch idea seems good but I just wish there was a simpler option. Hopefully someone is reading that wouldn’t mind tweaking the code a bit

(Troy Kelly) #4

@Smartnoob is it fixed times, fixed days of the week? Is the time likely to fluctuate? Is it based on other factors - state of the door, current mode, presence sensors etc?

Have you written SmartApp’s before? This might be a great chance to (with some help here) modify one that you could then share with the community.

(Lance) #5

The whole idea of this possible smartapp is my doorbell sucks. I can only hear it downstairs. When I’m expecting company when I’m upstairs they always have to call me cause I can’t hear them at the door. I almost always have my phone on me so my thinking is to create an app or modify one so that I can set a time period (4pm-5pm) of when I’m expecting company and set Smarthings to notify me when there is a knock at the door during those hours. And yes, the time would fluctuate, different days, different hours, closed door, presence sensors don’t matter and current mode doesn’t matter. I have never written code before. Just thinking quite a few people out there might want an app like this one too.

(Troy Kelly) #6

I am sure other people do @Smartnoob - but it is a matter of if those who write code have a need for it.

In our defence - we like contributing, but I think typically we are a little selfish with our time because (as far as I know) nobody is paid to contribute here.

The other dilemma (for me at least) is that it’s far better to teach a man to fish … (I’m sure you know the rest of the analogy).

The “Notify Me When” app - really is a good starting point if we can get you interested in cutting your teeth on some code.

Otherwise - I will try and find some time to write something for you.

(Lance) #7

I totally get where your coming from @troykelly. It’s not fair and not right to expect others to do work for you, I guess It’s just pretty intimidating to me to think about me writing code. I am pretty tech savy but just have no idea where to even start. I do have a very busy schedule with 2 small kiddos but I definitely would love to understand code and begin to learn. If you could point me in the right direction that would be awesome and if you could help me with the notify me app that would be even better! I mostly joined the community to participate in ideas to make Smarthings even better but if I could learn and create something new in the process, why not? Thanks!

(Troy Kelly) #8

I would like to welcome the newest programmer to SmartThings… @Smartnoob :smile:

First things first - have a logical think about what you want to achieve. From your description “Notify Me When” does everything you need, except for the time restriction.

Next is to work out a good way to handle it - to my mind the best way would be to schedule an event that subscribes to the relevant devices at the start time, and unsubscribes at the stop time.

When you subscribe to events for a device, that means your App will get notified when their state changes. Being able to subscribe and unsubscribe to those events will be a great solution for what you want to achieve.

Have you had a look at the code for the app as it stands now? It is located here.

(Lance) #9

It definitely helps to see the original code. Where do you go to get all the original codes?

(Brian) #10

In the IDE, create a new SmartApp and then in the code writing sectoin, there is a drop down list near the top right corner for Browse SmartApps

(Troy Kelly) #11

Most of them are here @Smartnoob (if you don’t want to go via the IDE)

(Lance) #12

Thanks everyone! You’ve all been super helpful, when I get some free time I’ll check out how these things are coded.

(Troy Kelly) #13

You are more then welcome @Smartnoob

The only “gotcha” that I think you may come across is failing to subscribe to events on a particular day because the start time is in the past.

For example - if you set your start time as 13:00 on any given day, and update your app at 14:00. It will not trigger for the current day, because the event has already occurred. You will still need to call the “schedule()” command for the following day, but you will also need to manually trigger the subscribe.

Once you have some code - it might be a good idea to paste it here for some comment and review :heavy_check_mark: