CJVann Posted November 21, 2011 Posted November 21, 2011 I expected the ELSE statement below to execute if the "Den Light" changes state to anything other than ON, but it's not. If "Den Light" is turned off (Switched On is false), shouldn't the Else statement run? If not, what WOULD cause the ELSE statement to execute? Thanks!! If Control 'Den Light' is switched On Then Set 'Holiday Lighting' On Else Set 'Holiday Lighting' Off
LeeG Posted November 21, 2011 Posted November 21, 2011 CJVann The Program will never run the Else clause. An If Control 'xxxxx' is switched On triggers the Program only when an On command is received from the device and the evaluation will always be True as coded. Use If Status rather than If Control. If Status triggers the Program anytime the Status changes. When the Status change results in a True evaluation of the If the Then clause runs. When the Status change results in a False evaluation of the If the Else clause run. If the Program should trigger whenever a command flows even when the Status does not change (pressing the On paddle twice for example) add an And Control ‘xxxxx’ is not switched Off to the existing If. The Program will trigger with an On command and an Off command. The If will be False with an Off command and run the Else clause. Lee
CJVann Posted November 21, 2011 Author Posted November 21, 2011 Thank you! I was expecting the statement to be evaluated anytime the device changed state, with "On" or "Off" deciding if the statement is True or False. (I'm actually trying to click a button on a RemoteLinc). Also, I've just discovered the RemoteLinc to have very unreliable communications here at my desk, further complicating troubleshooting. Thanks again, much appreciated!
LeeG Posted November 21, 2011 Posted November 21, 2011 You bet. Common misunderstanding about If Control versus If Status.
Recommended Posts