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.

Project Aim

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

PLEG Scene

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.

Device Properties
Name Device Name Device Variable
LightLevel Office Light Sensor CurrentLevel
Conditions
Name Expression
LightOff LightLevel > 20
LightOn LightLevel < 15
Actions for Condition: LightOff

Immediate

Device Action
Office Lamp(TKB) Off
Actions for Condition: LightOn

Immediate

Device Action
Office Lamp(TKB) On

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'

PLEG Inputs - Device Properties in VERAFigure 1: PLEG Inputs - Device Properties in VERA.

Conditions

  • 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

PLEG Conditions in VERAFigure 2: PLEG Conditions in VERA.

Actions

  • 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'

PLEG Actions in VERAFigure 3: PLEG Actions in VERA.

Save

  • When complete, close the PLEG window
  • Click the red 'SAVE' button at the top of the screen

Using PLEG

For this, and all PLEG scenes, to run, you must have PLEG 'Armed'.

PLEG ArmedFigure 4: PLEG Armed.

For further information take a look at the excellent Introduction Guide to PLEG - VERA Plugin and Introduction Guide to PLTS - VERA Plugin.

Related Information


 

Copyright Vesternet 2014

Updated: 08/03/14