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.

Variables ?

Featured Replies

Posted

So I notice isy has varaibles for use with Programs however the Wiki does not seem to mention them and in fact mentions using Programs to accomplish the same task which seems bulky to me.

I assume this is because variables are a newer feature than the Wiki entries.

 

Question I have is I was playing around with variables to create a Countdown type feature. ie press a button it decrements a variable with each press. This appeared to work fine. However the problem I had was I had 2 other programs whose if statement ran if the variable == 0 for one and the other was variable > 0.

 

Issue was those programs never ran. I would think those programs if statement would get evaluated anytime the variables value changed.

 

Any ideas why that would not work?

 

Count == 0

If
       $TestCountDown is 0

Then
       Set 'Office / Office-Chair-Lamp' Off

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

 

CountDown >0

If
       $TestCountDown > 0

Then
       Wait  10 seconds
       $TestCountDown -= 1

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

 

Set countdown

If
       Status  'Office / Office-Motion-Sensor' is On

Then
       $TestCountDown  = 4

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

 

I used a motion sensor to reset the count down. This program runs as expected, however the 2 that trigger on the $TestCountDown value do not run. If I manually run (if) on each they run as expected.

There is a forum Category dedicated to Variables. The first few topics cover Variables in detail.

 

If a Program is not being triggered with a Variable the variable is an Integer rather than a State variable. Both types are identical except State variables trigger Programs, Integer variables do not. This is all covered in the initial topics under the Variables forum category.

What Lee said plus a suggeston:

 

When you name your variables, start all integer variables with an "i" and all state with an "s". This makes it easy while writing and trouble shooting your programs to know what you are dealing with.

 

i.e.

"iCountdown"

"sCoundown"

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.