Jump to content

Garage Motion - Lights on with motion?


RichTJ99

Recommended Posts

Hi,

 

I currently have a motion program for when there is motion in the garage. I would like to add it so that my "Scene: Garage Lights", come on, stay on for 20 minutes, then shut themselves off, however if it sees motion during the countdown, the countdown should reset itself.

 

I would also like it that if the lights are already on, then it should just ignore itself.

 

I have this so far:

 

If
       Control 'Garage: Motion5-Sensor' is switched On

Then
       Send Notification to 'Default' content 'Garage Bay #5 Motion'
       Set Scene 'Scene: Garage 3 way' On
       Wait  20 minutes 
       Set Scene 'Scene: Garage 3 way' Off

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


 

 

 

EDIT: Is it possible to have a second program that if the time is after 11pm, and there is no motion, and the scene is on, that it would turn off the lights?

Link to comment

Unless you add some tests for your motion sensor to time out, or go read about how to do up some timers, even if you have motion your lights will go out in 20 minutes period.

 

And on the second question you can definitely have a program that looks at turning the lights off at 11:00 if the motion sensor is off. You will have to either close jumper 5 on the motion sensor and then make the changes in the ISY or by a bit of trial and error adjust the trim pot on the sensor to get about a 20 minute time out.

 

Personally, I have not tackled the timer programming myself. I would love to see Universal-Devices give us a timer method in the programming.

Link to comment

There is a good discussion on motion sensor programs on the wiki. In addition, there are LOTS of threads on the forum on this topic. It is arguably the singlemost programming example brought up, in my estimation.

 

RichTJ99, your program would work fine. Each receipt of an "on" command would halt any "wait" period, and restart the timer. Unfortunately, it did not include checking for the status of the lights. I am thinking we will have to check for three conditions: motion sensor, light status (no such thing as scene status), and program status.

 

If
Control 'Garage: Motion5-Sensor' is switched On
and 
(
status 'one of the garage lights' is off (assumes relay on/off only)
or
status 'light timer program' is true
)

Then
Send Notification to 'Default' content 'Garage Bay #5 Motion'
run 'light timer program' (then path)       

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

 

I would create a second program "light timer program"

 

if

then 
       Set Scene 'Scene: Garage 3 way' On
       Wait  20 minutes 
       Set Scene 'Scene: Garage 3 way' Off
       run 'light timer program' (else path)

else 

 

I would add a third program:

 

if
time is 1100pm
and 'light timer program' is false

then
set scene 'scene: garage 3 way' off

else

 

I would configure the motion sensor to have a relatively short time-out period. If you give this a try, let me know how it works.

Link to comment

So i guess there is no way to do it all in one program. I will start experimenting a bit.

 

One question, if I do this program, does this mean that if the garage lighting is off, and motion is detected, it will do everything in the then catagory?

 

If so, what happens the second time (say within a few minutes) I walk around the garage? Does it mean when it detects motion the second time, because garage#3 light is turned on, that all the then things will be ignored?

 

 

 

If
       Control 'Garage: Motion5-Sensor' is switched On
   And Status  'Office: Garage #3' is Off

Then
       Send Notification to 'Default' content 'Garage Bay #5 Motion'
       Set Scene 'Office: Garage 3-4-5' On
       Wait  20 minutes 
       Set Scene 'Office: Garage 3-4-5' Off

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


Link to comment

"if I do this program, does this mean that if the garage lighting is off, and motion is detected, it will do everything in the then catagory?"

 

Only if the 'Office: Garage #3' remains Off. If the Scene affects the Status of this device the statement(s) after the Wait will be bypassed. A change in 'Office: Garage #3' Status causes the Program to be triggered again which cancels the current Wait and evaluates the If again. Should the If be False the Else clause runs.

 

 

"what happens the second time (say within a few minutes) I walk around the garage? Does it mean when it detects motion the second time, because garage#3 light is turned on, that all the then things will be ignored?"

 

If 'Office: Garage #3' was turned On by the Scene it caused the Else to run effectively terminating the Program. The next motion triggers the Program again but since the 'Office: Garage #3' is now On the Else is run because the If is False.

Link to comment

RichTJ99,

 

Assuming garage3 is in scene garage 3-4-5, your program will NOT work as I believe you are expecting. As soon as the "then" path executes, the garage 3 light will come on, triggering a re-evaluation of your conditions, turning false, interrupting the "wait" statement, and running the else path. Furthermore, upon a second detection of motion, if the light is somehow on (even originally triggered by motion), your program will re-evaluate, interrupting the wait, and halting the countdown. It is to avoid problems like that that I suggested breaking this program into smaller pieces.

 

You have several conditions to find a way to evaluate: are the garage lights on? If so, are they on from a manual control, or from an earlier motion detect? Is it 1100pm? Is the timer in progress when it is 1100? Your stated desires is a good little excercise in ISY programming.

 

Make sure you check out the wiki on motion sensor programming. There is (or was the last time I checked) lots of good discussion on how to programmatically handle these decisions.

Link to comment

Is the motion sensor used for any other purposes? If it is just being primarily used to send notification and turn on lights it seems to me the easiest method to resolve this would be using the motion sensor timer itself. For example I have a motion sensor controlling a set of lights I only want to come on at night. Instead of a wait statement it looks more like this:

 

If
       Status  'Main Floor / Motion - Sensor' is On
   And Program 'Night.Define' is True   

Then
       Set Scene 'Main Floor / Night Lights - Inside' On

Else
       Set Scene 'Main Floor / Night Lights - Inside' Off

 

On the motion sensor settings I have the timeout set to 30 minutes so it won't turn status off until no motion has been detected for 30 minutes.

Link to comment
If it is just being primarily used to send notification and turn on lights it seems to me the easiest method to resolve this would be using the motion sensor timer itself.

 

The only problem with this approach is that it does not afford the ability to override the motion sensor by manually turning on the light

Link to comment
  • 1 month later...

So I decided to skip all the overriding business since i figured each time I moved & the sensor caught me it would restart the timer to 20 minutes.

 

So for some reason my lights never go off, even though both sensors say they are off. Any ideas why it wont turn the lights off & the program is still running?

 

If
       Status  'Garage: Motion5-Sensor' is On
    Or Status  'Garage: Motion 3 -Sensor' is On

Then
       Send Notification to 'Rich Email' content 'Garage Bay #5 Motion'
       Set Scene 'Office: Garage 3-4-5' On
       Wait  20 minutes 
       Set Scene 'Office: Garage 3-4-5' Off

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


Link to comment

RichTJ99-

 

When the last sensor switches off, the If re-evaluates to false, the wait is interrupted and the program runs the Else path with no timer etc.

 

Try changing Status MS On to Control MS on and I think you will be fine.

 

Alternatively, you could move the Then section to a separate program but I think just switching to Control in the If will solve your problem.

 

-Xathros

Link to comment

I have an almost identical setup. Here's a quick outline of what I've found works best after a year or so of trial-and-error:

 

1. Set the motion sensor to send ON only commands (these will be transmitted about every 10 seconds when motion is detected)

2. Put the motion sensor in a scene with the garage lights

 

Now the garage lights will turn on almost immediately (no delay waiting for a program to run), however they won't turn off. For that you'll need a program. I use a variable to keep track of how long it's been since the last motion event, and then use this to determine when to switch off the lights.

 

So, three more steps:

 

1. Create a state variable, lets say sGarageMotion

2. Create a program to control the variable:

 

If
       Control 'Garage / Garage Motion - Sensor' is switched On

Then
       $sGarageMotion  = 3
       Wait  15 seconds
       $sGarageMotion  = 2
       Wait  2 minutes and 45 seconds
       $sGarageMotion  = 1

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

Motion Variables:
1 = Normal state; no motion in the last 3 minutes
2 = Motion in the last 3 minutes, but not within the last 15 seconds
3 = Motion in the last 15 seconds

 

3. Create a program to shut off the garage lights:

 

If
       Status  'Garage / Garage Lights' is On
       And $sGarageMotion is 1

Then
       Wait  5 minutes 
       Set Scene 'Garage / Garage Lights' Off

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

Lights will switch off 5 minutes after being switched on manually (KPL, MobiLinc, etc.)
or 8 minutes after the last motion is detected (because of the 3 minute delay in the sGarageMotion variable control program.

 

 

Hope this helps.

 

- Brian

Link to comment

Archived

This topic is now archived and is closed to further replies.


  • Recently Browsing

    • No registered users viewing this page.
  • Forum Statistics

    • Total Topics
      36.9k
    • Total Posts
      370.3k
×
×
  • Create New...