Jump to content

Repeat and Wait not behaving as expected


Slalom

Recommended Posts

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')


Posted

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.

Posted

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.

×
×
  • Create New...