ISY-994i QuickStart: basic programming (conditionals)

Continuing our QuickStart mini-series, let’s cover the basics of ISY-994i programming. I’ve covered lots of programs over the years, but apparently, as a reader pointed out, I never covered the very basics of the structure.

Programs follow a pretty basic “if-then-else” structure. Let’s take a look at probably one of the most complicated programs I have, which you’ll see isn’t that complicated at all when you break it down into its parts:

isy-program-basics

I touched on this concept at the end of my last post about scenes in an example of how you could activate lights with a motion sensor via scenes or programs; this is one of my programs for accomplishing that goal.

We won’t go into exactly what this program does (perhaps another time…) because for now we’re just looking at the structure. As you can see, there’s an “if” clause in this program, and a “then” clause, but no “else” clause. The “then” clause is pretty straightforward and is restarting another program, but the “if” clause is a compound statement that deserves a closer look. Basically by using the parentheses (added with the buttons that say “Add And (…)” and “Add Or (…)”), we have three parts that make up this compound conditional.

  1. The first part itself has an “or” clause in there; you can see the dropdown that says “And” in the bottom box titled “Schedule”. When adding a clause to a conditional, you make this box either “And” or “Or” before clicking “Add to ‘if'”. This part is basically saying “this statement is only true if the time falls into certain hours around sunset OR certain hours around sunrise“.
  2. The next part says “this statement is only true if motion sensor A turns on OR motion sensor B turns on.”
  3. Finally, we say “this statement is only true if the kitchen light is NOT 80%.”

Once we execute each of those three statements to figure out if each of them are true, we join them together to basically say “run the THEN clause if part 1 is true AND part 2 is true AND part 3 is true. Otherwise run the ELSE clause (i.e., do nothing).”. So the next question is how does the program run at all, and when? Well, it essentially runs all the time, but nothing happens because not all of the “If” conditions are met. Every time the time of day, the state of a device, or a state variable (but NOT an integer value) changes within the ISY, every program’s conditionals are checked. So in this case:

  • Every minute the program “runs” and the first condition is true some of the times of the day, but not all.
  • Every time any device in this program changes state, the program “runs”. The second conditional is true if a) that device is one of those motion sensors, and b) the state of the motion sensor is “on”.
  • If we had state variables here (like those set when we enter and leave a geofence), the program would run when those changed.
  • Note the difference between the word “Control” in the second part, and “Status” in the third part of my program. You use “Control” when you want to test how a device was turned on, and you use “Status” when you want to test the brightness level of a device.

It’s important to keep in mind when a program will run in addition to what the conditions are. For example, in this program I only want to turn the lights on and then off after a period of time – but I only want to do THAT if the status of the light is not 80%. Why is this? Because if I hit the switch on the wall, it will turn on the light to 80%. After that, I don’t want this program to run at all because I no longer care about the motion sensors and want the lights to stay on until I turn them off. So hitting the switch on the wall changes the dim level to 80%, and the lights will stay on until manually turned off.

So this is why I check the STATUS of the lights (to check the dim level) but CONTROL of the motion sensors (to see how they were triggered). This is probably the toughest concept to grasp and is discussed in more detail on Universal Device’s wiki here and here.

So that basically covers the conditions for Schedule, Status, and Control. Two other possible conditions you may occasially use are “Program” and “Variable”. Variable is pretty self-explanatory – remember you can check the value of either variable type in your condition, but only state variables will actually cause a program to run. Program is relatively obvious too once you understand the one “rule”: a program is considered “true” if the “Then” condition runs, and a program is considered “False” if the “Else” condition runs.

isy-program-basics-condition

Posted by Matt Chiste
November 9
2 comments on “ISY-994i QuickStart: basic programming (conditionals)
  1. Matthew Birney says:

    This is very helpful. I have a similar program that I use to control lights with motion detectors, which I also want to override with a switch. It does not always work the way I want it to, and your suggestion to “stop” and then “run” the Kitchen Evening Light 5 Minutes program may just solve some of my problems.

    Could you provide some insight into your settings for your motion detectors? How do you ensure alignment of your program timer with your motion detectors’ “Timeout,” “Detecting Mode,” and “On Commands Only” settings?

    • Matt Chiste says:

      Matthew – great question. I actually have a post on my “to-do” list with the tenative title “Save battery on Insteon motion sensors by only sending ‘on’ commands”. I’ll share more details in the next week or two, but the short answer to your question is that I generally let the ISY handle the timeouts rather than the motion sensors themselves.

      In other words, let the ISY decide when to turn off the lights rather than the motion sensors, and in addition to having more control, you’ll save some battery in your motion sensors.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

 Subscribe to HomeAutomationGuru.com
    Add to Google Reader or Homepage

Enter your email address to subscribe: