How to link a motion sensor with a light bulb
One of the most common forms of home automation is linking a motion sensor with a light bulb so that the light comes on when motion is detected and the light goes off when motion hasn’t been detected for a while.
This can be achieved in one of two ways with Z-Command:
- through device association
- by creating an automation rule
The former method has the advantage of being somewhat easier to set up, but it is more limited. The latter method requires a little more understanding of automation (not rocket science) but is infinitely more powerful.
Automation through association
In this method, you program the motion sensor to send an “on” instruction to a light switch (bulb) when it detects motion and to send and “off” instruction to the light switch when it has not detected motion for a while.
Navigate to the motion sensor’s device detail page and scroll down to the association section.
Since your motion sensor is most likely battery powered and would be in “sleep” mode, querying it will only yield a queued command. You will need to wake it up by locating the action button on it and holding it down for about 1 second. If your sensor has no button, opening the case and leaving it open for the duration of this operation should do the trick.
Click the query button to get the current association status. You should see something similar to the screenshot below.
In the above example, the sensor has just one association group (Group 1). The single association group is able to control just one device (as indicated by Max. assoc.: 1). Assuming we want the motion to control device 3 (side table lamp in the example above), we will uncheck the checkbox next to Primary controller and check the one next to side table lamp. Finally, click set association to finalize the association.
Automation by rule
For a motion sensor to control a light bulb via automation rule, you need to create an automation event to detect when the motion sensor’s level has changed to a value higher than zero. You can name this “motion detected”.
Remember to click the create button after completing the form. Next, create another event for when no motion has been detected for a while as shown below.
Next, we need actions that the newly created events will trigger in order to actually turn the light on and off.
Create an action to turn the light on as shown below.
Create another action to turn the light off.
Finally, combine the events and actions into rules. Create a rule that combines the “motion detected” event with the “turn lamp on” action as shown below. Remember to click add event and add action then create.
Create an automation rule to turn the lamp off when no motion is detected.
Don’t forget to click create in each step
Remember to enable the newly created automation rules. They are disabled by default.
The advantage to the automation rule method of turning a lamp on and off is that it can be combined with other logic. For example, you can decide that the lamp should only respond to motion between 7 a.m. and 10 p.m. Or you could decide that the lamp should respond to motion during a certain period and only if the light level in the room is below a certain threshold (provided by a luminance sensor).