16 hours ago16 hr 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?
15 hours ago15 hr 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.
11 hours ago11 hr 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 statementsI'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