Jump to content

Turn a light on when a door sensor is tripped


416to305

Recommended Posts

Posted

Not sure why I'm having issues with this, seems like such a basic program but giving be a headache.  I have a hidden door sensor, and then a KPL at the front door.  All I want is when the front door opens at any time of the day, if the light is off, turn it on for 5 minutes and then turn it off, otherwise do nothing.

 

I tried doing something like:

 

If Control Front Door Sensor is ON and Front Entry Light is OFF

Then Set Front Entry Light ON, wait 5 minutes, Set Front Entry Light OFF

 

That's how I'd do it on Vera, but that doesn't work to turn the light off as I assume it's because once the door closes the IF is no longer true so the Wait ends.  So I did it like my normal motion sensor programs, and tried:

 

If Control Front Door Sensor is ON and Front Entry Light is OFF

Then Set Front Entry Light On, set variable S.FrontDoorStatus to 1

 

Then second program:

 

If s.FrontDoorStatus is 1

Then wait 5 minutes, set Front Entry Light OFF, set variable s.FrontDoorStatus to 0

 

This seems to work, but what's weird is that the light only comes on when I open the door maybe 1 in 3 times.  Sometimes I'll open it and just nothing happens, not even a delay just never comes on.  Then other times it's fine.  I feel like another program must be conflicting somewhere but not sure.  Will post the logs when testing later, but thought I'd see first the best way to do this type of program?  Thanks!

Posted

Nearest would be the LampLinc plug in dimmer which is on the same phase, probably 10-15 feet away clear line of sight, other than through the door frame where the sensor is.  Tried moving it maybe 5 feet away but same thing.  A KPL in a metal box is probably also 5 feet away.  I've never had issues with it before so not sure what is up, will check the logs but was mostly wondering if my program was the correct way basically to do it, as I want to rule out that it's my program causing the problems first.  Thanks!

Posted

To answer the last question, yes it does look good and I typically write programs using that state machine style. But I would move turning the light on to the second program, or even make it 3 states where 1=light turned on, and 2=waiting. This makes it easier to add other states and triggers later, like motion detection or a manual light control change.

 

Sent from my Nexus 7 using Tapatalk

Posted

Awesome thanks!  That makes total sense moving the light on to the second program.  I'll do the waiting variable as well as that was probably coming later as I will want ways to keep the light on and so on.  Thanks!

Posted

You are correct.  If an IF condition changes during a WAIT or REPEAT state during execution, the program will be halted, condition reevaluated, and program executed based upon the new condition.

 

Please note that you have two conditions.  The second condtion (Front Entry Light is OFF) is changed immediately when the program executes.  Since your program has a WAIT statement, the program will halt because the IF condition has now changed (Front Entry Light is now ON). 

 

For reasons that are probably a simple preference, I tend to program such things without variables when possible (nearly always).

 

If

control front door sensor is turned ON

and status front door light is OFF

then

run second program (then path)

 

second program:

if

nothing

then

turn on front door light

wait 5 minutes

turn off front door light

 

I can see no reason why your second program is less reliable in turning on the light.  The conditions are near-identical.

Posted

Thanks for the tips, I like that not using the variables!  So I figured a couple things out but still having an issue.  The reason the light wasn't working before was because I realized I had the light set after time out to Fade Down, thinking that meant Fade Down to Off, but it doesn't.  So I had to put Fade Down and then Off and that works.  The issue with it not working when the door opens is fixed by disabling my bedroom notification program.  I have a KPL in my bedroom and a program set that when the front door opens, flash and beep the KPL lights and keep them on for 5 minutes, as the master in my house is on the 3rd floor and frequently the sound of neighbours sound like it's my own door.  So it's nice to look over and see that the door hasn't opened.  Anyway, if I disable this program, the foyer light works as expected, but if it's enabled, only it works and not the foyer light.  Any idea why?

 

Here's the program that causes the conflict, disabling this fixes the other.

 

If

        Control 'Front Entry / Front Door- Door Sensor' is switched On

     Or Control 'Dining Room / Kitchen Door- Door Sensor' is switched On

     Or Status  'Garage / Garage Door-Sensor' is Off

Then

        Repeat 3 times

           Set Scene 'Front Entry / Door Open Notice' On

           Set 'Master Bedroom and Bath / Ceiling Light' 250 (Beep Duration)

           Set 'Master Bedroom and Bath / Ceiling Light' 250 (Beep Duration)

           Set 'Master Bedroom and Bath / Ceiling Light' 250 (Beep Duration)

           Wait  1 second

           Set Scene 'Front Entry / Door Open Notice' Off

        Repeat 1 times

           Set Scene 'Front Entry / Door Open Notice' On

           Wait  5 minutes

           Set Scene 'Front Entry / Door Open Notice' Off

 

Else

   - No Actions - (To add one, press 'Action')

 

*Scene 'Front Entry / Door Open Notice - is the 4 KPL buttons in the master bedroom as responders.

Posted (edited)

Those beeps without any break tie my ISY up for about 4-5seconds each where nothing else get handled.

 

I see long "system busy" pop-ups on my screen repeatedly.

 

When I tried using them I had to insert WAITs between them to allow other processing. I finally stopped using them as not one of the 25 units I have, that beep, can be heard more than a few feet away in a quiet room.

Edited by larryllix
Posted

I can't give an answer why disabling that program would cause a problem, but everytime I think I want a KPL to flash by toggling a scene on and off in a loop I have issues similar to what you describe and have never been able to figure it out.

 

As to the preference for using a variable or run a program, I usually find I need a variable since I might want to break out of the second program example that oberkc showed. Like if the switch was manually pressed... But that is one of the many reasons I love the ISY, different ways to solve the same thing...

 

Sent from my Nexus 7 using Tapatalk

Posted

That makes sense about the beeps causing issues.  I just added a wait 3 seconds to the start of then, and went to go test it when I realized this program only benefits me when I'm home alone, as if I open the door right now it's going to start chirping in the bedroom lol.  So I think I'll remove the beeps.  I find them loud though, earlier it was going off and I was on the 2nd floor and it's on the 3rd and I thought for a second who is playing with the set button on a device!? Then realized it was the KPL program.

Posted (edited)

...

  I find them loud though, earlier it was going off and I was on the 2nd floor and it's on the 3rd and I thought for a second who is playing with the set button on a device!? Then realized it was the KPL program.

I have no KPL units so maybe they are louder than all the plug modules and SwitchLincs that I have.

 

I seem to have better responses if I insert and entrance WAIT 1-2 seconds on items that are just counting or tracking things. This seems to give the time critical response programs a better response time. This becomes especially important with X10 command transmissions that can collide with Insteon stuff. Try 2 seconds between each beep also.

 

I also find that Rest commands cannot get through for over 20 seconds each night when the Query ISY runs @ 3:00 AM.

Edited by larryllix
Guest
This topic is now closed to further replies.

×
×
  • Create New...