On the heels of the post about ISY-994i programming conditionals, let’s take a look at possible actions you can take in “Then” and “Else” clauses of your programs. You can see the list after clicking the “Action” button under “Add to Program”:
Clearly there are a lot of different things you can have the ISY do in the “Then” clause after a condition is met (or not met, in the “Else” clause). Here’s a quick list:
- Insteon: You can adjust the state of scenes and devices here. I’ve talked before about why you might want to only control scenes rather than devices, and this is one of those reasons. Specifically, if you have to replace a device, you would just add the new device back to the scene and not have to worry about going into multiple programs to update each of them.
- Send X10: If you have X10 devices you can send control signals here.
- Notify: Here’s where you configure notifications; see this post for more information on configuring text notifications, or this one for an alternative notification mechanism.
- Program: You can control other programs with this option. Selecting this option gives you another drop-down list with further options:
- Run (If): With this option, a program’s conditionals in the “if” clause will be checked, and the “then” or “else” clause would be run based on the outcome. The thing to keep in mind is that if you choose this option, the program will run whether it’s enabled or disabled. That is, as we discussed in the “conditionals” post, if a conditional says “If Status of Light is Off”, the program will run every time the status of that light changes – running “then” if the light is Off and “else” if the light is On. But maybe you don’t want the program to run WHEN the state changes, but you still want this conditional to determine what to do. In that case, you can actually DISABLE that program. That will prevent it from running when the status changes, but you can still execute the program by calling this “Run (If)” option.
- Run Then: This will bypass the conditional completely, and runs the “Then” clause.
- Run Else: This will bypass the conditional completely, and runs the “Else” clause.
- Stop: In some cases, you may have a program running for a long while and want to stop it. I used this case in my motion sensor light activation program – basically it uses one program to turn on a light, wait 5 minutes, then turn it off. If additional motion is detected, that program is stopped and restarted, which essentially resets the 5 minute clock.
- Enable: Enable the program, which simply means the conditionals are executed as mentioned above.
- Disable: Disable the program. This doesn’t preclude it from being executed from another program, but prevents it from running when conditions change. For example, say you have a program that turns off your lights when you leave a geofence. But if you have a houseguest and don’t want the lights to turn off on them when you go to work… you could just temporarily disable that program.
- Enable Run at Startup: See above on disabling and enabling programs; this determines whether the program is enabled when the ISY starts.
- Disable Run at Startup: See above on disabling and enabling programs; this determines whether the program is disabled when the ISY starts.
- Wait: Tells the program to pause for a specific amount of time. As mentioned above, if one program is running but “waiting”, another program can programmatically “stop” it. There’s an option to slightly randomize the time you want to wait.
- Repeat: This allows you to do one or more tasks more than once – and you can add an element of randomization. For example, when you’re away you could have the ISY turn on a light for a random amount of time (about 10 minutes), wait a random amount of time (about 30 minutes), and repeat both of those tasks a random NUMBER of times to give the appearance that you’re home.
- Variable: You can change variables here and peform any number of operations. Note that if you change a variable, you may want to also add a line to use Init To. For example, I have a counter for how many times my doorbell has been rung (don’t ask why – I have no idea!), but in addition to saying “$doorbell += 1”, I also have a line saying “$doorbell Init To $doorbell”. Those two lines say “increase the count of the $doorbell variable”, and “save the $doorbell variable so that if the ISY is restarted, it will initialize back to that value again”.
- Adjust Scene: You know how in a scene you can set the brightness of individual devices? Well, that’s what this option is for. Although I don’t know why you’d want to programmatically tweak scenes this way, it’s nice to know you can.
- System: This option shows up if you have optional modules installed.
- Network: This option exists if you have the Network Module installed, and allows you to call out to various other systems such as Pushover.
One last thought on Actions: there are very real scenarios where you may have a program that doesn’t even have an “If” clause, but there are items in both “Then” and “Else”. This program will never run by itself, but other programs can call “Run Then” or “Run Else” to execute those commands. Another real scenario this might be valuable in is with the Amazon Echo integration. Say you want to have a mode called “Movie Mode” that does a bunch of things like turn off some lights and turn on others, and maybe set some variables or disable some sensors. You could create a program that has no If clause but a Then clause that does all these actions. And an Else clause that does basically the opposite. Then you could set up the Amazon Echo to link to this program as follows:
Now when I “turn on” this program with the keyword “Movie Mode”, “Movie”, or “T.V.”, the ISY will run the “Then” clause. Saying “Turn Off Movie Mode” does the opposite and runs the “Else” clause.