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.

Endless Loop in program

Featured Replies

Posted

Hi

 

I'm trying to use my harmony remote to toggle on and off a scene for watching TV... here's the script. I don't know what's going wrong, but the "Toggle Watch TV" program is stuck looping over and over again and the lights turn on and off, until I disable the script...

 

Any thoughts?

 

 

 

(name:Watch_TV)

--------------------------------------------------

If

IR 'IR_001' is Released

 

Then

Run Program 'Toggle Watch TV' (If)

 

Else

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

 

--------------------------------------------------

 

(name:Toggle Watch TV)

--------------------------------------------------

If

Status 'TV Light' is Off

 

Then

Set Scene 'Button B -Watch TV' On

 

Else

Set Scene 'Button B -Watch TV' Off

How about something like this instead:

 

WATCH TV ON

 
If
       IR 'IR_001' is Pressed
   And Status  'TV Light' is Off

Then
       Set Scene 'Button B - Watch TV' On

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

 

 

WATCH TV OFF

 
If
       IR 'IR_001' is Pressed
   And Status  'TV Light' is On

Then
       Set Scene 'Button B - Watch TV' Off

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

Hello ketchup,

 

In your original programs, simply clear the Enabled checkbox for the Toggle Watch TV program, so that it only runs when called from another program. This should prevent the oscillation.

 

However, Mike's approach will actually be a tab bit faster, since it doesn't have one program calling another program, which adds some latency. Whether the difference would be noticeable, would need to be tested.

 

In Mike's Watch TV Off program, I would change the line:

 

 
   And Status  'TV Light' is On

to:

 

 
   And Status  'TV Light' is Not Off

in case the light happened to be between 99% and 1% (not On, and not Off).

  • Author

thanks for the replies

 

coming from a programming background, it feels a bit constrained with the fixed format of the IF Loops, but it seems to work fine now. I'm using Mike's version with two if loops, one button though...

 

press once = on

hold = off

 

I'm really starting to like the IR option and I'm really glad to have bought it.

In Mike's Watch TV Off program, I would change the line:

 

Good point Darrell! Usually I'm pretty good about using "Nof OFFs", but I copied from a program I was using to control a relay.

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.