Door Sensor

I feel like I’m missing something simple here, but for the life of me can’t wrap my head around this.

I’ve got a Ecolink door/window sensor mounted to my patio door. I want it to ONLY send me alerts if it detect motion during certain parts of the day (ie 7am-4pm and 11pm-5am).

I set up 4 scenes that are each triggered during those times. What it does is:

[ul][li]@ 7am, arm the sensor[/li]
[li]@ 4pm, put the sensor in bypass[/li]
[li]@ 11pm, arm the sensor[/li]
[li]@ 5am, put the sensor in bypass[/li][/ul]

Then I set notifications on the sensor that if it’s ARMED and opens OR if it’s ARMED and closes, to send me a notification.

So what it’s doing now is at 7am, it sends me a notification that the door is closed. I only set up the scenes last night, so I don’t know what else it’s going to auto-send me. FWIW, it did NOT send me a “door is closed” at 11pm last night.

Any ideas? I only want it to send me an alert if the door is opened/closed in those hours.

I’m mobile so I can not write an in depth response. What you want to do will either require some complex lua / luup code in your motion tripped scenes. What you’ll need to do is create a scene to be triggered when ever an armed sensor is tripped and add lua / luup code to check for the time is between your preferred time. There are examples on the forum showing how to do this.

Or the easiest way is to use the pleg plugin which will make this easier to do with many examples found in the pleg plugin subforum.

  • Garrett

I agree yse Pleg and set 4 conditions. With Pleg you can say only if it opens or closes during this time.

Right now your scenes are set up for AND.
door closed and its X time. That becomes true as soon the time hits if even if the door was already closed and hasnt changed.

Dtock scenes are very limited and this is why most of us move away from them and use PLEG which is like an advanced scene generator.

Search the forums there is a whole section On it And a pdf called “pleg basics” in one post which is where u should start.

I’m not sure why you would set the notification to send you something if it is armed and closed. That is the ‘normal’ state you would expect, correct? For a door/window sensor movement is generally thought of as going from closed to open.

Regardless of your need, which I may not understand, RexBeckett has a great ‘Conditional Scene Scripting Guide’ at this forum post [url=http://forum.micasaverde.com/index.php/topic,18679.0.html]http://forum.micasaverde.com/index.php/topic,18679.0.html[/url]

I would suggest you check out the Time Period example and the Using Functions example. You should be able to convert the time period example into a function. That way you can create two of them to cover both of your desired time periods and combine them just like the Functions example shows. Put the functions you create in the Lua Startup and they will be available in any scene you create.

PLEG, as @garrettwup and @integlikewhoa suggest, is also an option but dabbling in a bit of lua/luup code (especially with a great template to start from) is a nice learning exercise, IMHO. Even if you don’t use it for this, reading and knowing the Conditional Scene Scripting examples exist will be useful for some less complex scenes you might create in the future.

@ctguess. Yeah, it occurred to me not to worry about the close. I can think of scenarios where it would be nice to know, but for the most part all I would truly care about is if the door was opened.

I’ve glanced at PLEG before, but am having trouble figuring out how to truly do anything with it. I haven’t spent a lot of time on it, so it would be nice to see an example with pictures for how to set it up. If I could see a walk thru on it that would really help me.

[quote=“jhjones75, post:5, topic:186896”]@ctguess. Yeah, it occurred to me not to worry about the close. I can think of scenarios where it would be nice to know, but for the most part all I would truly care about is if the door was opened.

I’ve glanced at PLEG before, but am having trouble figuring out how to truly do anything with it. I haven’t spent a lot of time on it, so it would be nice to see an example with pictures for how to set it up. If I could see a walk thru on it that would really help me.[/quote]

If you have PLEG installed post your status report and we can help.

Basicly 3 sections to fill out with the condition being the brains and where you should be asking for the help.

The inputs you add for this would only be the door and timer (in the schedule section of inputs/triggers)

The actions for this would be empty since your not turning anything on, but on the first page at the bottom you’ll add a notification.

The condition ahhhh

This is where the magic happens. Create a name of your choice on the left.

“DoorOpenAlert” We can say.

To the right of that is where we put the conditions that when true will fire the action or the alert. For the most basic test you can type the name you gave to the input trigger for the door here. Now when you open and close the door the condition “DoorOpenAlert” will become true, and if you setup a action for “DoorOpenAlert” it will fire or if you setup a notification when “DoorOpenAlert” is “Satisfied” then that alert fill fire also.

Start with what and post your status report in PDF and we can help setup the times and order they happen.

PLEG basics is your cliff notes or cheat sheet. Also once you have the basics you will see other have posted their status report which will give you examples.

So do I need to create a scene and base it off the device that PLEG creates? Or just edit the PLEG device itself and put all the details in there?

Okay, so I have the below. When I pull up the report I get “error getting status of DoorOpenAlert”

Triggers

Name Description
EatInDoor Whenever Eat-In French Doors is armed and opened

Schedules

Name On Type On Time On Days Random On Delay Off After Type Off Time Off Days Random Off Delay
DaySched Weekly 07:00:00 1,2,3,4,5 None Weekly 16:00:00 1,2,3,4,5 None
NightSched Weekly 23:00:00 1,2,3,4,5,6,7 None Weekly 05:00:00 1,2,3,4,5,6,7 None

Conditions

Name Repeat Expression
DoorOpenAlert No EatInDoor and (DaySched or NightSched)

Notifications

Name Description Users Last Sent
Ext Back Door Open Door Sensors PLEG has satisfied condition: DoorOpenAlert jhjones75 undefined

Its better to click the status report button on the first page click print and change printer to save as pdf. Post that file. No information in it will help anyone besides you. Your key is for your vera serial only.

Its common practice to see this as it shows everything including any spelling issues.

Also no is not correct. It would be “not” or most of us would use “!EatInDoor”

“NOT” and “!” is the same

You get that error because it didnt understand that condition basically because something is wrong in it.

I think the “no” in his entry is for Repeat. It is not part of his condition. Another reason to post the report pdf…following headings and columns in this unformatted forum is challenging.

Im on my phone here so forgive me beong short, but

Also this will need to be changed to include an order or youll have the same problem. Right now the way you have it worded its gonna fire if the door was opened before the time and then the time came True.

Basically the way its worded is if both are true no matter which happened first it will fire the notification. This is where order comes into play.

So adding this to what you have would day that the day schedule has to be true before the door was opened inorder for the condition to become true or send a notification.

(DaySched; EatInDoor)

Also looking back at your first post i dont think you want the not or the !

Thats to reverse the input. You already have it set to when its open its true. If you add ! To it now it will be true when its closed. So your notification will come when door is closed not opened.

Yes good catch, your probley right. Didn’t make sense to have not on that input.

Attached is what I have.

I went home at lunch and it’s definitely not working, so I’ve got something wrong in there.

appreciate all the help!

we need the “status” it gives us more information, times and whats true. But i suspect if you just made the times they are not true yet. See the day time flips to true when the start time is passed. If it already past then you create it it wont work until tomorrow when the time its that start. To over come this now. Hit the “do it now” next to the trigger to manually activate it now.

Here’s the status report.

That makes sense about the schedule starting. I clicked the doitnow button but can’t test it until tonight.

I’m still getting an error about getting the status of “DoorOpen” when I click either the status or report button.

Well I’m really not sure what happened, but in the middle of editing the device my browser crashed on me and when I went back in the device was completely gone from my Vera. Recreated it from scratch and now no longer getting the errors. I guess I can test it tonight and see what happens.

FWIW, I also changed the condition to (DRDaySched or DRNightSched) and EatInDoorOpen if it matters

The order does not matter. Have the and just means when both are “TRUE” then the condition is “TRUE”

Looking at your report I can see the timer looks good now. The Day timer is already true as you can see under “STATE”. That should turn to False at 16:00.

The door was lasted opened for 5 sec at 11:24.

I do see a problem tho with your condition still. See how it shows “undefined”. That should be a “0” if it was correct and hasn’t been run yet. So you still have a problem which I don’t see what it is from here.

When you installed the PLEG plugin did you also the “Program Logic Core” plugin that goes along with it?

Something seems to be missing here. I would think if that was it tho you would get another error at startup. And you should reload luup and refresh browser now and recheck. You should be getting that same error you had before the way it is now.

I wasn’t sure if the Core installed automatically or not, so I installed it first, then installed PLEG, so yeah, I see them both.

I completely closed my browser and went back in and now my Condition shows as 0. There is nothing else listed as undefined. So fingers crossed that at this point I’m good. I can’t test til I get home this evening.

Thanks for all the help.

[quote=“jhjones75, post:19, topic:186896”]I wasn’t sure if the Core installed automatically or not, so I installed it first, then installed PLEG, so yeah, I see them both.

I completely closed my browser and went back in and now my Condition shows as 0. There is nothing else listed as undefined. So fingers crossed that at this point I’m good. I can’t test til I get home this evening.

Thanks for all the help.[/quote]

Yea you should be good then. 0 is normal if it’s never changed states yet. After you will see times of when it was true and when it was false. Same for the Notification.

Later you might want choose to add to it if needed. If this door ever gets left open then the Schedule kicks in it will trip. With below it will not unless the door is opened after one of the schedules are already true.

EatInDoorOpen and ((DRDaySched and (DRDaySched; EatInDoorOpen)) or (DRNightSched and (DRNightSched; EatInDoorOpen)))

Later you might replace the scheduled with something more accurate like if your HOME or AWAY. Using your phones geofence (gps) or ping sensor if connected to your home wifi it can see if your home or not. I do this with me and the wife’s phone and if either is home no notifications and if anyone is away then arm it.