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.

Repeat and Wait not behaving as expected

Featured Replies

Posted

Hi

 

 

 

The following program decrements the variable at a rate of one click per second, pretty much as expected.

 

If
       Elk Zone 'MB Closet Motion' is Normal
   And $sMasterBedroomClosetMotion > 0

Then
       Repeat Every  1 second
          Wait  1 second
          $sMasterBedroomClosetMotion -= 1

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


 

I had thought that this program would increment the variable at the rate of one click per second... But it pretty much counts up as fast as it can until it hits the limit.

 

If
       Elk Zone 'MB Closet Motion' is Violated
   And $sMasterBedroomClosetMotion < $iMasterBedroomClosetMaximumOnTime
   And $sMasterBedroomClosetOffOverride is 0

Then
       Repeat Every  1 second
          $sMasterBedroomClosetMotion += 1
          Wait  1 second

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


 

I was relatively certain that the second program worked until the ISY was rebooted. But it certainly does not now.

 

Firmware is 3.1.16 with the elk module.

 

The first question is why doesn't the second program work as expected.

 

But in addition to that, even the first program went into 'hyper-speed' when I did not have the wait construct in it as shown below.

 

I would have thought that the 'repeat every ' construct should be enough to set the rate.

 

What am I doing wrong?

 

If
       Elk Zone 'MB Closet Motion' is Normal
   And $sMasterBedroomClosetMotion > 0

Then
       Repeat Every  1 second
          $sMasterBedroomClosetMotion -= 1

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


In your second program, move the wait 1 second in front of the +=1 line.

 

The reason it is running up too fast is because every time 1 gets added to that variable, the program triggers again and it re-evals the if. You actually don't need the repeat clause at all in either program. They are both getting reset every time the variable changes and the program starts all over from scratch.

  • Author

Knew it had to be something stupid :oops:

 

Thanks!

 

In your second program, move the wait 1 second in front of the +=1 line.

 

The reason it is running up too fast is because every time 1 gets added to that variable, the program triggers again and it re-evals the if. You actually don't need the repeat clause at all in either program. They are both getting reset every time the variable changes and the program starts all over from scratch.

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.