Jump to content

Program to Latch light on with motion dectector


colby

Recommended Posts

Posted

I am trying to write a program to turn my Patio lights on with motion at night only, but also have the ability to override the lights On so that after the 1min 30secs the lights to do not turn off if i am outside for an extended period of time. I have most of this working, BUT, the lights will not turn off.

The Program 1 and 2 and 3 are working but not 4 (the off program) the program then statement will not run even though program 3 is true (i know its true because the light turns on, but when I go to the ISY after the light turns on, i should see the "then" running because of the wait 1min 30secs but its not running. any help why all parts of the then statement is not running would be great.

Program 1 - Patio Lights Disable

If And Control 'patio lights' is switched on

And Status 'patio lights' is not off

 

Then

$ignore_motion_detection = 1

 

Program 2 - Patio Lights Enable

If Control 'patio lights' is switched off

 

Then

$ignore_motion_detection = 0

 

I can see variable count go up and down so I know these 2 programs above are working

Program 3

If from sunset +30mins

to sunrise -30mins next day

And 'patio motion detector' = on

 

Then

Set Scene "Patio Lights' On

Wait 1 min 30 secs

Run program 'patio lights off' (if)

 

for the above program the lights turn on, but i never see the "wait" happen in the isy, so i think maybe when the motion goes off the then statement stops? but i have other programs that once the then starts and if statement becomes falses it still keeps on running.....

 

Program 4 - patio lights off

If $ignore_motion_detection = 0

 

Then

Set Scene 'Patio Lights' off

 

please help thanks!

Posted

Is the Variable an Integer or State Variable?

 

Also post the actual Programs. Two of them have invalid statements. Right click on Program name, select Copy to Clipboard. Paste to forum post.

Posted

Try this method instead:

 

If Control ON AND Status Off
Then
Disable Program Motion Light
Turn Lights On
Wait 1 Hour
Enable Program Motion Light

 

If Control OFF And Status On
Then
Enable Program Motion Light
Turn Lights Off

 

If Time is Night And Status Motion Detected
Then
Turn Lights On
Wait 1min 30sec
Turn Lights Off

Posted

Hi Lee attached below are exact from my programs, also I setup the variable using integer, should i have used state?

 

Disable program

If

Control 'Patio Lights Living Rm Right' is switched On

And Status 'Patio Lights Living Rm Right' is not Off

Or (

Control 'Patio Lights Kitchen Door' is switched On

And Status 'Patio Lights Kitchen Door' is not Off

)

 

Then

$Ignore_Motion_Detection = 1

 

Else

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

 

 

enable program

If

Control 'Patio Lights Living Rm Right' is switched Off

Or Control 'Patio Lights Kitchen Door' is switched Off

 

Then

$Ignore_Motion_Detection = 0

 

Else

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

 

 

lights on program

If

From Sunset + 30 minutes

To Sunrise - 30 minutes (next day)

And Status 'Exterior Patio-Sensor' is On

And Status 'Patio Lights Kitchen Door' is Off

And Status 'Patio Lights Living Rm Right' is Off

 

Then

Set Scene 'Patio Lights' On

Wait 1 minute and 30 seconds

Run Program 'Patio Motion Lights OFF' (If)

 

Else

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

 

 

lights off program

If

$Ignore_Motion_Detection is 0

 

Then

Set Scene 'Patio Lights' Off

 

Else

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

 

 

i am just puzzled why the lights will turn on, via the lights on program, but i never see the 1 min 30min wait happen is the isy programming, but integer moves up and down from 1 to 0 correctly.

Posted

The first thing to look at is how long the motion sensor reports On Status. If it turns Off before the 1 minute 30 second Wait expires the 'Patio Motion Lights OFF' Program will not be invoked because of the change in Sensor Status.

 

The second item to look at is what Scene 'Patio Lights' turns On. If this Scene changes the Status of 'Patio Lights Kitchen Door' or 'Patio Lights Living Rm Right' the 'Patio Motion Lights OFF' Program will not be invoked because of the change in Status of either of these devices.

 

If

From Sunset + 30 minutes

To Sunrise - 30 minutes (next day)

And Status 'Exterior Patio-Sensor' is On

And Status 'Patio Lights Kitchen Door' is Off

And Status 'Patio Lights Living Rm Right' is Off

 

Then

Set Scene 'Patio Lights' On

Wait 1 minute and 30 seconds

Run Program 'Patio Motion Lights OFF' (If)

 

Else

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

Posted

The simple solution is to split the Program into two Programs.

 

If

From Sunset + 30 minutes

To Sunrise - 30 minutes (next day)

And Status 'Exterior Patio-Sensor' is On

And Status 'Patio Lights Kitchen Door' is Off

And Status 'Patio Lights Living Rm Right' is Off

 

Then

Run Program 'xxxx'

 

Else

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

 

Program 'xxxx'

If

Then

Set Scene 'Patio Lights' On

Wait 1 minute and 30 seconds

Run Program 'Patio Motion Lights OFF' (If)

 

That way when any of the Status changes occur the second Program will not be affected.

Posted

Thanks Lee G. I tried this last night and worked like a charm. Thanks for your advice! Brilliant solution!

Guest
This topic is now closed to further replies.

×
×
  • Create New...