Jump to content
View in the app

A better way to browse. Learn more.

Universal Devices Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

What is wrong with this program

Featured Replies

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

Hmm, what are you trying to do? You have the lights turn off when they are off.

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.

  • Author
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

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.

  • Author

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

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?

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

  • Author
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.

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!

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.

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.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.