Vera Secure - 1.7.3535
Z-Uno - 2.1.3
Sketch - 5 Motion Sensors
Code: Select all
#define BINARY_PIN1 18
#define BINARY_PIN2 19
#define BINARY_PIN3 20
#define BINARY_PIN4 21
#define BINARY_PIN5 22
// Global variables to store data reported via getters// Global variables to store data reported via getters
byte lastBinaryValue1;
byte lastBinaryValue2;
byte lastBinaryValue3;
byte lastBinaryValue4;
byte lastBinaryValue5;
ZUNO_SETUP_SLEEPING_MODE(ZUNO_SLEEPING_MODE_ALWAYS_AWAKE);
// Set up 5 channels
ZUNO_SETUP_CHANNELS(
ZUNO_SENSOR_BINARY(ZUNO_SENSOR_BINARY_TYPE_MOTION, getterBinary1),
ZUNO_SENSOR_BINARY(ZUNO_SENSOR_BINARY_TYPE_MOTION, getterBinary2),
ZUNO_SENSOR_BINARY(ZUNO_SENSOR_BINARY_TYPE_MOTION, getterBinary3),
ZUNO_SENSOR_BINARY(ZUNO_SENSOR_BINARY_TYPE_MOTION, getterBinary4),
ZUNO_SENSOR_BINARY(ZUNO_SENSOR_BINARY_TYPE_MOTION, getterBinary5)
);
void setup() {
pinMode(BINARY_PIN1, INPUT_PULLUP);
pinMode(BINARY_PIN2, INPUT_PULLUP);
pinMode(BINARY_PIN3, INPUT_PULLUP);
pinMode(BINARY_PIN4, INPUT_PULLUP);
pinMode(BINARY_PIN5, INPUT_PULLUP);
}
void loop() {
byte currentBinaryValue1 = digitalRead(BINARY_PIN1);
byte currentBinaryValue2 = digitalRead(BINARY_PIN2);
byte currentBinaryValue3 = digitalRead(BINARY_PIN3);
byte currentBinaryValue4 = digitalRead(BINARY_PIN4);
byte currentBinaryValue5 = digitalRead(BINARY_PIN5);
if (currentBinaryValue1 != lastBinaryValue1) {
lastBinaryValue1 = currentBinaryValue1;
zunoSendReport(1);
}
if (currentBinaryValue2 != lastBinaryValue2) {
lastBinaryValue2 = currentBinaryValue2;
zunoSendReport(2);
}
if (currentBinaryValue3 != lastBinaryValue3) {
lastBinaryValue3 = currentBinaryValue3;
zunoSendReport(3);
}
if (currentBinaryValue4 != lastBinaryValue4) {
lastBinaryValue4 = currentBinaryValue4;
zunoSendReport(4);
}
if (currentBinaryValue5 != lastBinaryValue5) {
lastBinaryValue5 = currentBinaryValue5;
zunoSendReport(5);
}
}
byte getterBinary1() {
return (lastBinaryValue1 == 0) ? 0 : 255;
}
byte getterBinary2() {
return (lastBinaryValue2 == 0) ? 0 : 255;
}
byte getterBinary3() {
return (lastBinaryValue3 == 0) ? 0 : 255;
}
byte getterBinary4() {
return (lastBinaryValue4 == 0) ? 0 : 255;
}
byte getterBinary5() {
return (lastBinaryValue5 == 0) ? 0 : 255;
}
Choose general widget --> Device Options --> 1 Add Group --> Set to: Z-Wave 0; _Scene Controller 0 After applying the Association settings should be like this Now Z-Uno can send Sensor Binary and Alarm via multichannel association.
Need to set the widget type to D_MotionSensor1
In each widgets --> Advanced
device_type = urn:schemas-micasaverde-com:device:MotionSensor:1
device_file = D_MotionSensor1.xml
device_json = D_GenericIO1.json
Should be like this