Using PLEG to activate lights based on light level
This guide shows how to use the PLEG plugin to control a light based on the ambient light level detected by a Z-Wave light sensor.
PLEG is a plugin for VERA that enables you to more easily create complex scenes than is possible in the standard VERA scene editor.
The aim of this project is to simply control a light based on the ambient light level.
- Turn light on when the ambient level is below a pre-set level
- Turn light off when the ambient level is above a pre-set level
- For this example we've used the Philio 4-in-1 sensor, but you can also use the Aeon MultiSensor or Express Controls EZMotion
- To control the light we have used a TKB On/Off wall plug, but you could use any plug, relay or dimmer
When explaining PLEG scenes people use a very simple notation to show show exactly what is used in each section of the PLEG scene. In this example we will use the simple notation and show how this is added to PLEG.
|Name||Device Name||Device Variable|
|LightLevel||Office Light Sensor||CurrentLevel|
|LightOff||LightLevel > 20|
|LightOn||LightLevel < 15|
Actions for Condition: LightOff
Actions for Condition: LightOn
Creating the Scene in PLEG
Input - Device Properties
- In the VERA UI, click on the PLEG's 'Wrench' Icon
- Go to the Inputs tab and select Device Properties
- Select the Light Sensor device from the drop-down - in this example 'Office Light Sensor'
- Select the 'device property' to use as the input - in this example 'CurrentLevel'
- Click the 'Create' button
- Click 'Edit' and give the Input a user friendly name (LightLevel)
- Click 'Accept'
Figure 1: PLEG Inputs - Device Properties in VERA.
- Go to the Conditions tab
- Click the 'Add Row' button
- Give the condition a user friendly name - in this example 'LightOff'
- Enter the Condition Expression - in this example 'LightLevel > 20'
- Click the 'Add Row' button and add the second condition
Figure 2: PLEG Conditions in VERA.
- Go to the Actions tab
- Select the 'Condition' from the drop-down - in this example 'LightOff'
- Select the device and action - in this case the Office Lamp TKB to turn Off
Note: This is the same as selecting device actions in a normal VERA scene
- Click 'FINISHED' at the top of the Screen
- Repeat for the other 'Actions'
Figure 3: PLEG Actions in VERA.
- When complete, close the PLEG window
- Click the red 'SAVE' button at the top of the screen
For this, and all PLEG scenes, to run, you must have PLEG 'Armed'.
Figure 4: PLEG Armed.
- APNT-59: VERA Program Logic Plugins
- Introduction Guide to PLEG - VERA Plugin
- Introduction Guide to PLTS - VERA Plugin
- APNT-34: Creating VERA Scenes
Copyright Vesternet 2014