Jump to content

Motion sensor program to turn of lights


doug95630

Recommended Posts

Posted

I am trying to write a program to turn of lights if my daughter leaves them on in the middle of the night.  My problem is that the program status is always "true" and runs no matter is the motion sensor is on or off.  I've tried setting the motion sensor to "is not on".  No difference. Motion sensor settings are below.

 

 

Night Motion - [iD 0006][Parent 0001][Not Enabled]

If
        From     11:00:00PM
        To      Sunrise (next day)
    And Status  'MOTION SENSOR FR-Sensor' is Off
    And Status  'Breakfast Nook Light' is not Off
     Or Status  'Entry Light-A' is not Off
     Or Status  'Entry Light-B' is not Off
     Or Status  'Family Room Lights' is not Off
     Or Status  'Kitchen-A' is not Off
     Or Status  'Kitchen-B' is not Off
     Or Status  'Downstairs Hallway Light' is not Off
 
Then
        Wait  30 minutes
        Set Scene 'Downstairs Off' Off
        Set 'Entry Light-A' 30%
        Wait  10 minutes
        Set 'Entry Light-A' Off
        Set 'Entry Light-B' Off
 
Else
   - No Actions - (To add one, press 'Action')
 post-6687-0-97205800-1468211320_thumb.jpg

Posted

The MS is a battery power device. As such, it does not always correctly respond to a query unless put into linking mode. Most especially Status is not accurate for the MS, only Control is. Delete the sensor from your program (unless you use control as a trigger) and depend on the status of the controlled device(s).

Posted

Delete the sensor from your program (unless you use control as a trigger) and depend on the status of the controlled device(s).

I don't fully understand, but I think you are suggesting that if the motion sensor controlled something, like a light, I could watch status of the controlled device, instead of the status of the MS, correct?

 

Are there reliable motion sensors? I do have Elk integration.

Posted

Most motion sensors are reliable. But battery powered device cannot be accurately queried unless they're in linking mode.

Posted

Doug95630

 

I suspect you problems have less to do about motion sensor reliability and more to do with programming logic. Do you know about parentheses in programs? Try putting parentheses around the last seven lines of your program condition.

 

Alternatively, what harm do you see in completely eliminating the last seven lines of your program?

Posted (edited)

Try putting parentheses around the last seven lines of your program condition.

This.

 

The multiple 'or' conditions mean that if any one of them are true, the whole 'if' clause is true.

 

If you want to group them together (as in ''If any of these are on"), then they need to be nested in a parenthesis.

Edited by MWareman
Posted (edited)

I would break your solution down into individual programs for each light.

 

That way you can use different time allowances and different conditions for each zone of lighting.

 

Does the time of day really matter for all of them? Lights left on during the day should be the same a problem.

Edited by larryllix
Posted

Doug95630

 

I suspect you problems have less to do about motion sensor reliability and more to do with programming logic. Do you know about parentheses in programs? Try putting parentheses around the last seven lines of your program condition.

 

Alternatively, what harm do you see in completely eliminating the last seven lines of your program?

 

I did have parenthesis previously and it did not seem to help.  Here is what I think it should be to group all the lights in one big "or" condition.  I am at work so this is from memory, not cut and paste from the program.  The reason I do not remove the "or status" for all the lights is that I want the ISY to do something if she leaves any of the lights on, or dimmed (not off).  I could change this to a status "on" query.  The reason I use a time of day condition is that I want normal operation when we are using the rooms during the day.  My wife would be annoyed if she is reading a book and the lights turn off on her.

 

Night Motion - [iD 0006][Parent 0001][Not Enabled]

 

If

        From     11:00:00PM

        To      Sunrise (next day)

    And Status  'MOTION SENSOR FR-Sensor' is Off

    And (

          Status  'Breakfast Nook Light' is not Off

     Or Status  'Entry Light-A' is not Off

     Or Status  'Entry Light-B' is not Off

     Or Status  'Family Room Lights' is not Off

     Or Status  'Kitchen-A' is not Off

     Or Status  'Kitchen-B' is not Off

     Or Status  'Downstairs Hallway Light' is not Off

           )

 

Then

        Wait  30 minutes

        Set Scene 'Downstairs Off' Off

        Set 'Entry Light-A' 30%

        Wait  10 minutes

        Set 'Entry Light-A' Off

        Set 'Entry Light-B' Off

 

Else

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

Posted
The reason I do not remove the "or status" for all the lights is that I want the ISY to do something if she leaves any of the lights on, or dimmed (not off).

 

I understand.  I suggest, however, that if your intentions are simply to "turn of lights" (per original post), then the only harm is that the ISY will send an OFF command to lights that are already OFF.  To me, that is harmless enough.  If your new program fails to achieve your goals, you might try this approach as an intermediate step.  This could help troubleshooting.

Posted

I understand.  I suggest, however, that if your intentions are simply to "turn of lights" (per original post), then the only harm is that the ISY will send an OFF command to lights that are already OFF.  To me, that is harmless enough.  If your new program fails to achieve your goals, you might try this approach as an intermediate step.  This could help troubleshooting.

 

Oh, I see.  The KISS principle (keep it simple).  I can remove the query of the lights as a trouble shooting step.  My only reason for adding them is so that I can then turn all lights off except one (30%) for safety.  It then turns itself off after a period of time.  I'll give this a try this evening.  Thx.

Posted

Oh, I see.  The KISS principle (keep it simple).  I can remove the query of the lights as a trouble shooting step.  My only reason for adding them is so that I can then turn all lights off except one (30%) for safety.  It then turns itself off after a period of time.  I'll give this a try this evening.  Thx.

try first the parentheses.  It is my hope that this will work.  If so, you are done.

 

But...yes...I like simple better than complicated, all other things being equal.

Guest
This topic is now closed to further replies.

×
×
  • Create New...