
App for Motion Activated Light
==============================
==============================

This app listens for VALUE_REPORT messages on the bus. If a preselected value from a preselected node
is received (with a value !=0) the LED stripe attached to the node which runs this app will be turned on in
the preselected color for a preselected time. If in this time another matching message is received the
light timer gets restarted. If no matching message is received within the preselected time the light is
turned off again.

Typical usage is to watch for a motion message from some node with a motion sensor and react to that.
This app can watch for up to two node-value pairs.

This app can also watch for brightness sensor messages to only turn on light if it is dark enough.



1. Values
======


1.1 MALONTIME
-------------
On-Time after activation:
 aqhome-tool setdata -N nodes/XXXXXXXX/MALONTIME TIME_IN_1/10_SECS

Example:
 Keep light on after activation for 20 seconds
 aqhome-tool setdata -N nodes/12345678/MALONTIME -v 200


1.2. MALSOURCE1, MALSOURCE2
---------------------------

Sources for Motion Messages:
 aqhome-tool setdata -N nodes/XXXXXXXX/MALSOURCE1 -v VVNN
 aqhome-tool setdata -N nodes/XXXXXXXX/MALSOURCE2 -v VVNN

 VVNN is a 16-bit value, lower 8 bit contain the source node address, higher 8 bit contain the
 value id to react to.
 
Example:
 React to value report messages with value id 7 from node with address 2
 aqhome-tool setdata -N nodes/12345678/MALSOURCE1 -v 0x0702


1.3. MALSOURCEB
---------------------------

Source for Birightness Messages:
 aqhome-tool setdata -N nodes/XXXXXXXX/MALSOURCEB -v VVNN

 VVNN is a 16-bit value, lower 8 bit contain the source node address, higher 8 bit contain the
 value id to react to.

 If no brightness source is given (i.e. NN part is 0) then brightness will be ignored.

Example:
 React to value report messages with value id 0b (LIGHT) from node with address 2
 aqhome-tool setdata -N nodes/12345678/MALSOURCEB -v 0x0b02


1.4. MALVALUEB
---------------------------

Brightness value below which light is to be turned on.
 aqhome-tool setdata -N nodes/XXXXXXXX/MALVALUEB -v NN

The value highly depends on the type of sensor. Those photodiodes used e.g. by N27 nodes
have values between 0-1023 but the actual range depends on many factors (like location of the
sensor etc).

Therefore this value can be adjusted here.

Example:
  Only turn light on if brightness sensor reports a value below 200
  aqhome-tool setdata -N nodes/12345678/MALVALUEB -v 200


