multiple sensors and vera

Discussion about Z-Uno product. Visit http://z-uno.z-wave.me for more details.
aivs
Posts: 29
Joined: 04 Mar 2011 15:26

Re: multiple sensors and vera

Post by aivs » 01 Mar 2018 16:41

How to Vera + Z-Uno 5 Binary Sensors

Vera Secure - 1.7.3535
Z-Uno - 2.1.3
Vera5Sensors.png
Vera5Sensors.png (287.67 KiB) Viewed 820 times
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;
}
Z-Uno sends reports from the channels using multichannel association to Lifeline, but by default Vera sets basic association. So at first need to add Vera into Z-Uno multichannel association.
Choose general widget --> Device Options --> 1 Add Group --> Set to: Z-Wave 0; _Scene Controller 0
multichannelAssoc.png
multichannelAssoc.png (108.23 KiB) Viewed 820 times
After applying the Association settings should be like this
AssocSettings.png
AssocSettings.png (103.3 KiB) Viewed 820 times
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
Advanced.png
Advanced.png (121.38 KiB) Viewed 820 times
Attachments
Vera5Sensors.png
Vera5Sensors.png (287.67 KiB) Viewed 820 times
Advanced.png
Advanced.png (121.38 KiB) Viewed 820 times
multichannelAssoc.png
multichannelAssoc.png (108.23 KiB) Viewed 820 times
Advanced.png
Advanced.png (121.38 KiB) Viewed 820 times
AssocSettings.png
AssocSettings.png (103.3 KiB) Viewed 820 times
Vera5Sensors.png
Vera5Sensors.png (287.67 KiB) Viewed 820 times
Last edited by aivs on 01 Mar 2018 16:50, edited 1 time in total.

petergebruers
Posts: 220
Joined: 26 Jul 2015 17:29

Re: multiple sensors and vera

Post by petergebruers » 01 Mar 2018 16:50

Ah! Finally some details about multichannel association on vera! I bet this is a very important point. It has been mentioned before... It is important on other controllers as well. I do not own a "vera" so I cannot test this.

Question... You say "Need to set the widget type to D_MotionSensor1". What happens if you do not do that? I am asking this, because I have mentioned that I think vera needs to have a device specific configuration file...

Tillsy
Posts: 28
Joined: 15 Feb 2018 03:51

Re: multiple sensors and vera

Post by Tillsy » 02 Mar 2018 00:15

OMFG!!! aivs sir, you are a LEGEND!!!

I simply added that association and, seconds later, everything lit up like a Christmas tree! Have also shorted the pins to ground and, instantly, each one caused the green LED to do a data transmission and the Vera updated the relevant sensor status.

This desperately needs adding to the Z-UNO site - as I'm not the only one to have spent an incredible amount of time on this issue.

Thank you :) :) :) :) :)


jim_meyer
Posts: 3
Joined: 29 Jun 2015 22:31

Re: multiple sensors and vera

Post by jim_meyer » 20 May 2018 23:16

I am experiencing the same original problem in this thread.... In my case I have 2: ZUNO_SENSOR_MULTILEVEL(ZUNO_SENSOR_MULTILEVEL_TYPE_DISTANCE...... ) Channels. Based on what I see in the Ardurino Serial Monitor my sketch is running correctly.

When I first pair the Z-Uno with my Vera Edge I get 4 devices... one with the name I assigned when I paired (the "parent") and the other 3 are called "_GET_LANG(generic_sensor,sensor) 1", "_GET_LANG(generic_sensor,sensor) 2", '_GET_LANG(generic_sensor,sensor) 3'.... which I find pretty weird.

All 4 devices have the following Advanced Params:
device_type: urn:schemas-micasaverde-com:device:GenericSensor:1
device_file: D_GenericSensor1.xml
device_json: D_GenericSensor1.json

The "parent" works OK... it updates its CurrentLevel variable on a regular basis.... But the 3 children are really slow to update.... seems like 10 minutes or more. "_GET_LANG(generic_sensor,sensor) 1" displays the same distance as the Parent but does not update as often. "_GET_LANG(generic_sensor,sensor) 3" displays my 2nd distance sensor... but again updates are real slow. "_GET_LANG(generic_sensor,sensor) 4" never updates.

I can go into the "parent" Device Options" and add the Associations as described above in this thread... But entering Device options for any of the children simple displays a "N/A"... so I can not assign Associations to those devices.

Also, there are a lot of Advanced->Variables that are present for the Parent (35 of them) that do not exist for the 3 Children.... which only has 5.

Can anyone shed some light on this and help me get to the point where my second distance sensor updates more often?

Thank you!

User avatar
PoltoS
Posts: 4268
Joined: 26 Jan 2011 19:36

Re: multiple sensors and vera

Post by PoltoS » 23 May 2018 00:10

You only need to set this Association to 1.0 (Multichannel Association) on the root device

Post Reply