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.

random command execution

Featured Replies

Hi,

 

I'm trying to write a program which simulates a TV being on, using a dimmer (as part of my vacation programs).

This is what I currently have:

If
  - No Conditions - (To add one, press 'Schedule' or 'Condition')

Then
       Repeat 1 times (Random)
          Wait  3 seconds
          Wait  3 seconds (Random)
          Set 'LR LampLinc TV' 50%
       Repeat 1 times (Random)
          Wait  3 seconds
          Wait  3 seconds (Random)
          Set 'LR LampLinc TV' 75%
       Repeat 1 times (Random)
          Wait  3 seconds
          Wait  3 seconds (Random)
          Set 'LR LampLinc TV' On

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

 

I was hoping that the "Repeat 1 times (Random)" would work to randomly execute certain statements, but that didn't work so well. I guess the 'randomness' is between 1 and the value specified (was hoping it's 0).

Is there another way to randomly execute statements?

 

Thanks

Heiko

Hi Heiko,

 

Repeating random (in your case) means that it would either repeat the block or not execute at all.

 

I think what you need is to use the Random function on Wait instead of repeat. This way, the amount of time waited for the next statement will be random.

 

With kind regards,

Michel

Hi,

 

I'm trying to write a program which simulates a TV being on, using a dimmer (as part of my vacation programs).

This is what I currently have:

If
  - No Conditions - (To add one, press 'Schedule' or 'Condition')

Then
       Repeat 1 times (Random)
          Wait  3 seconds
          Wait  3 seconds (Random)
          Set 'LR LampLinc TV' 50%
       Repeat 1 times (Random)
          Wait  3 seconds
          Wait  3 seconds (Random)
          Set 'LR LampLinc TV' 75%
       Repeat 1 times (Random)
          Wait  3 seconds
          Wait  3 seconds (Random)
          Set 'LR LampLinc TV' On

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

 

I was hoping that the "Repeat 1 times (Random)" would work to randomly execute certain statements, but that didn't work so well. I guess the 'randomness' is between 1 and the value specified (was hoping it's 0).

Is there another way to randomly execute statements?

 

Thanks

Heiko

  • Author
Repeating random (in your case) means that it would either repeat the block or not execute at all.

That's exactly what I want, randomly executing the block (or not). Unfortunately it doesn't seem to work, it always executes all the blocks.

 

I think what you need is to use the Random function on Wait instead of repeat. This way, the amount of time waited for the next statement will be random.

Using Wait is my backup solution, but this would cause my TV simulation not to be random. It would always go from 50%, to 75%, to 100%. I could probably make the code a bit more extensive, so it looks more random.

 

Heiko

Create an account or sign in to comment

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.