As discussed in an earlier post on the Insteon Motion Sensor, the most basic of setups for having a motion sensor control a light switch is through the use of a scene. You would create a new scene that included the switch as both a controller and a responder, and add the motion sensor as a controller. That way, when motion is detected, an “on” signal is sent to scene (turning on the switch which is configured as a responder), and when the timeout period expires, an “off” signal is sent.
That’s simple, but there’s a use case where it makes sense to introduce an ISY-994i program: what happens if you’re in a room and not necessarily moving, such as when you’re watching TV or staring blankly at a rock for several minutes? The problem with the scene-based approach is that, because no motion is detected, the lights may end up turning off on you while you’re still in the room, so we need some way to override the motion sensor when we’re planning on some quality rock-staring time. There are LOTS of different ways to do this, but we’ll cover a reasonably simple setup here.
First, let’s check our motion sensor configuration:
- Open the battery compartment on the back of the sensor and confirm that the 5th jumper pin is attached. This allows us to configure the motion sensor through software, rather than those other jumpers and dials (see the motion sensor manual for details):
- Next, hold down the set button for about 5 seconds until the LED on the front starts blinking. This puts the device in “set” mode so that the ISY-994i can “talk” to it (to conserve battery life, Insteon wireless devices aren’t always “listening” for updates; they just send signals when events occur).
- Now, select the sensor in the ISY-994i device list, and click the “Options” button on the right, which will bring up the configuration for the sensor:
- Here, you’ll want to put in a value for the Timeout (number of minutes the lights will stay on), and you want to check the first and second boxes, to notify the network when motion is continually sensed and to send an “Off” signal when the timeout expires. Depending on whether you want the triggers to fire only at night, you can un-check the last option. For example, in a basement where there aren’t windows you’d leave this unchecked so the lights go on every time, but in a naturally lit room you’d want it off so that motion is triggered only when it’s dark outside. You can tweak the Darkness Sensitivity if you find the lights going on when it’s not very dark out, or not going on when it is pretty dark. The lower the number, the more dark it has to be for the event to fire.
- Click “OK” and the configuration will be written back to the sensor.
Now that our sensor is set up, it’s time to write our program. We’re using a dimmer switch so we’re going to use a little trick to avoid having to set any variables: we’re going to let a specific dim level be a flag that tells the program whether the light was turned on by a switch, or whether it was turned on by the motion sensor. The code is pretty straightforward, so let’s take a look at it first – note there are two programs:
Program: Motion-On
If Status 'Sensor-Motion' is On And Status 'Light' is Off Then Set 'Light' 99%
Program: Motion-Off
If Status 'Sensor-Motion' is Off And Status 'Light' is 99% Then Set 'Light' Off
The first thing to notice here is that we’re controlling a device (in this case, called “Light”), not a scene. This is important because scenes don’t have dim levels available, and we don’t want, say, a KeypadLinc button lighting up when motion is sensed.
Second, notice how we’re not turning the light ON when motion is sensed, but setting the dim level to 99%? Your eye won’t be able to tell the difference between 99% and 100%, but now the program can tell whether the light was turned by the program (if it’s at 99%) or by a switch (if it’s at 100%).
Let’s say for example you’re using this program on your front porch to turn on the lights when someone walks up. But, when you have a party with people coming and going all night, you want to leave the light on for the duration. So, you hit the switch and the light turns on to 100%. Then, when your first guest arrives, the motion sensor triggers “ON”, but the status of the light isn’t OFF, so the Motion-On program effectively doesn’t run.
Similarly, suppose the first guest walks up and the light is off – then the Motion-On program will run and set the light to 99%. But, to prevent it from going off again when the motion sensor times out, you just hit the switch for the light, its dim level goes to 100%, and the Motion-Off program effectively doesn’t run.
So there you have it – a relatively simple program for operating a light via a motion sensor. This definitely isn’t the only way, and if you’re interested in some real mind-bending programming voodoo that uses the ISY-994i as the timer (rather than the one in the motion sensor), check out the Universal Device’s Wiki for a comprehensive write-up.