Jump to content

my light keeps turning off with this program, need help


kevman

Recommended Posts

Posted

So the objective of this program is to turn on the foyer light when ever I walk near the motion sensor (zone6) and only when the alarm is armed (stay_mode). The problem I have is when I turn on the foyer light manually it will simply turn off after one minute, which I don't want it to do. Can anyone point me in the right direction?

 

 

If

$Zone6 is 1

And Program 'stay_mode' is True

 

Then

Set Scene 'Foyer' On

 

Else

Wait 1 minute

Set Scene 'Foyer' Off

Posted

so what is causing the variable to change and cause the if clause to evaluate and then be false so it runs the else?

 

Alan

Posted

All changes to $Zone6 and Program 'stay_mode' trigger the Program. Most of the time the If is going to be evaluated False which results in the Wait and turning the Set Scene 'Foyer' Off. I assume these statements were put in the Else because the Set Scene 'Foyer' Off was not being executed when put in the Then clause. They don't get executed because a Wait allows the If to be reevaluated. The Program trigger condition changes to False during the Wait so the statement(s) after the Wait do not get executed.

 

Rather than put the Wait and Set Scene 'Foyer' Off in the Else, split the logic into two Programs. The first Program triggers as coded now but invokes a second Program from the first Program Then clause which has the Then clause

 

Then

Set Scene 'Foyer' On

Wait 1 minute

Set Scene 'Foyer' Off

 

This way the If in the first Program does not get revaluated because there is no Wait statement.

Posted

Nothing is needed in the second Program If section.

 

If

$Zone6 is 1

And Program 'stay_mode' is True

 

Then

Run Program 2

 

Else

 

 

 

If

 

Then

Set Scene 'Foyer' On

Wait 1 minute

Set Scene 'Foyer' Off

Else

Guest
This topic is now closed to further replies.

×
×
  • Create New...