Guest edilks Posted November 6, 2011 Share Posted November 6, 2011 In my IF statement I am testing a "control" condition for a switch being turned on. Does this mean that when the switch is turned on it will execute the THEN and when it is turned off it will execute the ELSE? It seems to execute the THEN only when I turn the switch on. There seems to be no execution of the program at all when I turn the switch off. Do I need to have two separate programs for this, one to test on and one to test off conditions? (I know the switch can just be added as a controller of a scene which will follow the on/off but I have other things I want to do when the switch is toggled) Link to comment
LeeG Posted November 6, 2011 Share Posted November 6, 2011 edilks The Program triggers each time an On command is received from the device. The Else never runs because the Program only triggers with an On command and the If is always True. To run the Else with an Off command add an And Control device not Off to drive the Else on an Off command. If Control 'ICON Dimmer 1' is switched On And Control 'ICON Dimmer 1' is not switched Off Then Send X10 'A1/On (3)' Else Send X10 'A1/Off (11)' Lee Link to comment
Guest edilks Posted November 6, 2011 Share Posted November 6, 2011 Lee, Understood. Works perfectly now. A "status" condition line must be a different animal. I would assume it is not based on the occurrance of an insteon event, but rather on the current state of some insteon device being monitored by ISY. So, the program execution must be triggered by either a change of state of one of the "status" conditions or an occurrance of an specific event being called out by one of the "control" conditions. Is my understanding correct? Thanks, Eric Link to comment
LeeG Posted November 6, 2011 Share Posted November 6, 2011 edilks If Control triggers based on command flow from the device. If Control On triggers each time an On command comes from the device. If a SwitchLinc, each time the top of the paddle is pressed an On command is sent and the Program triggers. This happens whether the device was Off going to On, or already On staying On. If Status uses the device status the ISY keeps track of. The Status must change for the Program to trigger. Pressing the top of the SwitchLinc paddle twice (not fast enough for a Fast On) the Program would be triggered only once, when the device status went from Off to On. The already On to On would not trigger the Program again. Because If Status triggers the Program on a change in Status the additional line in the If is not required to drive the Else. A simple if Status is On triggers the program on both the ON and OFF change in Status. The Then clause runs when the Status changes to ON because the condition is True and the Else clause runs when the Status changes of OFF because the condition is False. The choice of Control versus Status is made based on what situation should trigger the Program. Lee Link to comment
oberkc Posted November 7, 2011 Share Posted November 7, 2011 So, the program execution must be triggered by either a change of state of one of the "status" conditions or an occurrance of an specific event being called out by one of the "control" conditions. Is my understanding correct? Yes. Or by a time-based condition. Link to comment
oberkc Posted November 7, 2011 Share Posted November 7, 2011 So, the program execution must be triggered by either a change of state of one of the "status" conditions or an occurrance of an specific event being called out by one of the "control" conditions. Is my understanding correct? Yes. Or by a time-based condition. Link to comment
Recommended Posts