Skip 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.

Do all If values need to be state variables?

Featured Replies

I've got a simple program looking at some values to trigger the Then, but it's not triggering:

If
	$ShadeLowerDesiredHour is $Hour
	And $ShadeLowerDesiredMin is $Minute
	And $AnybodyHome is 0
Then...

All values on the first two lines are Integer variables, and $AnybodyHome is a State variable.

I can watch the values as the desired time approaches, and they do match at the appropriate time - but nothing happens. Is the fact that the first two lines don't include State variables causing the program to never evaluate as true?

Solved by Guy Lavoie

  • Solution

Yes, state variables exist for the purpose of triggering actions on their values. Integer variables won't do anything in If/And/Or statements, they're only useful for doing calculations, etc.

3 hours ago, Guy Lavoie said:

Yes, state variables exist for the purpose of triggering actions on their values. Integer variables won't do anything in If/And/Or statements

I'd like to add something else here, potentially useful in certain programming situations. My phrase "Integer variables won't do anything in If/And/Or statements" isn't quite true: integer variables can be tested in If/And/Or statements, but they won't trigger the program if they're what end up making the program true, They're useful as static conditions that you might want to be true for other triggering conditions that you want to test for. An example: you might want to test that an alarm system is in armed status to allow some triggering actions, like motion detection to trigger an action. But you might not want that action triggered if motion was already detected and you're now just arming the system. By setting the armed status into an integer variable, you can avoid that second condition from happening.

Create an account or sign in to comment

Account

Navigation

Search

Search

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.