Jump to content

What is wrong with this program


AnthemAVM

Recommended Posts

Posted

This lights turn on, but not off after the 10 minutes

 

If

• Status '0A.43.29-Sensor' is On

• And Status 'Garage - Can Lights' is not On

 

Then

• Set 'Garage - Can Lights' Off

• Wait 10 minutes

• Set 'Garage - Can Lights' Off

Posted
This lights turn off, but not off?

 

If

• Status '0A.43.29-Sensor' is On

• And Status 'Garage - Can Lights' is not On

 

Then

• Set 'Garage - Can Lights' Off

• Wait 10 minutes

• Set 'Garage - Can Lights' Off

I suspect you meant "This lights turn on, but not off?", and that your program actually is:

 

If

• Status '0A.43.29-Sensor' is On

• And Status 'Garage - Can Lights' is not On

 

Then

• Set 'Garage - Can Lights' On

• Wait 10 minutes

• Set 'Garage - Can Lights' Off

 

If that is so, then the reason the lights don't turn off is because when the lights turn on the If becomes False, and when the Wait is reached, the program stops executing the Then and begins executing the Else.

 

The solution is to break it into two programs:

 

Program 'Garage Motion'

If

• Status '0A.43.29-Sensor' is On

• And Status 'Garage - Can Lights' is not On

 

Then

• Run Program 'Garage Lights' (Then Path)

 

Program 'Garage Lights'

If

 

Then

• Set 'Garage - Can Lights' On[/n]

• Wait 10 minutes

• Set 'Garage - Can Lights' Off

 

See our wiki article on motion sensors.

Posted
This lights turn off, but not off?

 

If

• Status '0A.43.29-Sensor' is On

• And Status 'Garage - Can Lights' is not On

 

Then

• Set 'Garage - Can Lights' Off

• Wait 10 minutes

• Set 'Garage - Can Lights' Off

I suspect you meant "This lights turn on, but not off?", and that your program actually is:

 

If

• Status '0A.43.29-Sensor' is On

• And Status 'Garage - Can Lights' is not On

 

Then

• Set 'Garage - Can Lights' On

• Wait 10 minutes

• Set 'Garage - Can Lights' Off

 

If that is so, then the reason the lights don't turn off is because when the lights turn on the If becomes False, and when the Wait is reached, the program stops executing the Then and begins executing the Else.

 

The solution is to break it into two programs:

 

Program 'Garage Motion'

If

• Status '0A.43.29-Sensor' is On

• And Status 'Garage - Can Lights' is not On

 

Then

• Run Program 'Garage Lights' (Then Path)

 

Program 'Garage Lights'

If

 

Then

• Set 'Garage - Can Lights' On[/n]

• Wait 10 minutes

• Set 'Garage - Can Lights' Off

 

See our wiki article on motion sensors.

 

Thanks Darryl,

 

If after the wait, it goes the the Else statement, could I move the set garage lights off in the else state?

 

Michael

Posted
Thanks Darryl,

 

If after the wait, it goes the the Else statement, could I move the set garage lights off in the else state?

 

Michael

Hello Michael,

 

Good question. The program will switch from the Then to the Else as soon as it encounters the Wait, so the Wait will not be executed. However, you could put the Wait in the Else, like this:

 

If

• Status '0A.43.29-Sensor' is On

• And Status 'Garage - Can Lights' is not On

 

Then

• Set 'Garage - Can Lights' On

• Wait 10 minutes

 

Else

• Wait 10 minutes

• Set 'Garage - Can Lights' Off

 

I haven't tested this. The Wait in the Then may still be required, or may not be; try it both ways, and let us know how it works.

Posted

Good news, the below program works.

 

If

• Status '0A.43.29-Sensor' is On

• And Status 'Garage - Can Lights' is not On

 

Then

• Set 'Garage - Can Lights' Off

• Wait 1 minutes

 

Else

• Wait 5 minutes

• Set 'Garage - Can Lights' Off

Posted
Good news, the below program works.

 

If

• Status '0A.43.29-Sensor' is On

• And Status 'Garage - Can Lights' is not On

 

Then

• Set 'Garage - Can Lights' Off

• Wait 1 minutes

 

Else

• Wait 5 minutes

• Set 'Garage - Can Lights' Off

Michael, thanks for the update, and for the idea--I never thought of doing it that way before. It should aid organization by keeping the code together in one program rather than two.

 

Did the Wait in the Then turn out to be necessary?

Posted
Just curious - why would the WAIT in the THEN section be necessary? Just want to make sure I understand...

 

I had just left it in, didn't want to mess with something that worked.

 

I will take it out and try it again tonight.

Posted

Thanks for testing!

 

 

Darrell -

 

Could you tell me why you thought that might be an issue? I want to make sure I understand how this program would work on the ISY.

 

Thanks!

Posted
MikeB, possibly to trigger a re-evaluation of the program's conditions as per this thread: http://forum.universal-devices.com/viewtopic.php?t=1757 , but if I understand the way the Then statements should operate, they should simply complete and then the program's conditions would be automatically re-evaluated without the need to be triggered by a Wait statement.

Dave, well stated, thanks so much. Yes, that is exactly what I had in mind, and you are correct that without any Wait or Repeat statements, the entire Then (or Else) clause should be atomic, and therefore should complete before the If conditions are reevaluated. My suggestion was merely to test this.

Guest
This topic is now closed to further replies.

×
×
  • Create New...