multiple sensors and vera

Discussion about Z-Uno product. Visit http://z-uno.z-wave.me for more details.
dualarrow
Posts: 6
Joined: 25 Oct 2017 14:32

multiple sensors and vera

Post by dualarrow »

if I write a sketch with multiple ZUNO_SWITCH_BINARY all works well. I end up with multiple switches and they all seem to work.

However when I try to setup multiple sensors, I see the sensors, but changing the state on the inputs doesnt change the state on vera. I have put debugging into the sketch and can confirm that the loop is correctly setting variables accordint to their state and I can confirm that the getter is being called when the state changes and returns the correct value. My sketch is as follows

Code: Select all

// LED pin number
// 13 pin - user LED of Z-Uno board
#define LED_PIN 13

ZUNO_SETUP_CHANNELS(ZUNO_SENSOR_BINARY(ZUNO_SENSOR_BINARY_TYPE_GENERAL_PURPOSE,getter1),ZUNO_SENSOR_BINARY(ZUNO_SENSOR_BINARY_TYPE_GENERAL_PURPOSE,getter2),ZUNO_SENSOR_BINARY(ZUNO_SENSOR_BINARY_TYPE_GENERAL_PURPOSE,getter3));

byte last1,last2,last3;

// the setup routine runs once when you press reset:
void setup() {
  pinMode(LED_PIN, OUTPUT); // setup pin as output
  pinMode(11,INPUT_PULLUP);
  pinMode(10,INPUT_PULLUP);
  pinMode( 9,INPUT_PULLUP);
}
// the loop routine runs over and over again forever:
void loop() {
  // loop is empty, because all the control comes over the Z-Wave
  byte current;

  current = digitalRead(11);
  if (current != last1) {
    last1 = current;
    zunoSendReport(1);
  }
  current = digitalRead(10);
  if (current != last2) {
    last2 = current;
    zunoSendReport(2);
  }
  current = digitalRead(9);
  if (current != last3) {
    last3 = current;
    zunoSendReport(3);
  }
}

byte getter1() {
  if (last1 == 0)
    return 0xff;
  else
    return 0;
}

byte getter2() {
  if (last2 == 0)
    return 0xff;
  else
    return 0;
}

byte getter3() {
  digitalWrite(13,last3 ? 0xff:0);
  if (last3 == 0)
    return 0xff;
  else
    return 0;
}
Can anyone see if i'm doing anything wrong ?
petergebruers
Posts: 255
Joined: 26 Jul 2015 17:29

Re: multiple sensors and vera

Post by petergebruers »

It works on my Z-Way controller. Unfortunately, I do not own a Vera. But here is an idea...

I have made one slight change in getter3(). It now briefly turns on the LED, instead of setting it to variable "last3". This way you see a "blip" each time the getter is called.

I also tried ZUNO_SENSOR_BINARY_DOOR_WINDOW but apart from a change in type in Z-Way it works in the same way. But you can try it...

Can you please try this sketch? Does the white LED flash, each time you change state of pin 9? And each time your controller polls the Z-Uno?

Code: Select all

// LED pin number
// 13 pin - user LED of Z-Uno board
#define LED_PIN 13

ZUNO_SETUP_CHANNELS(ZUNO_SENSOR_BINARY(ZUNO_SENSOR_BINARY_TYPE_GENERAL_PURPOSE, getter1), ZUNO_SENSOR_BINARY(ZUNO_SENSOR_BINARY_TYPE_GENERAL_PURPOSE, getter2), ZUNO_SENSOR_BINARY(ZUNO_SENSOR_BINARY_TYPE_GENERAL_PURPOSE, getter3));

// Alternative setup:
//ZUNO_SETUP_CHANNELS(
//  ZUNO_SENSOR_BINARY_DOOR_WINDOW(getter1),
//  ZUNO_SENSOR_BINARY_DOOR_WINDOW(getter2),
//  ZUNO_SENSOR_BINARY_DOOR_WINDOW(getter3));

byte last1, last2, last3;

// the setup routine runs once when you press reset:
void setup() {
  pinMode(LED_PIN, OUTPUT); // setup pin as output
  pinMode(11, INPUT_PULLUP);
  pinMode(10, INPUT_PULLUP);
  pinMode( 9, INPUT_PULLUP);
}
// the loop routine runs over and over again forever:
void loop() {
  byte current;

  current = digitalRead(11);
  if (current != last1) {
    last1 = current;
    zunoSendReport(1);
  }
  current = digitalRead(10);
  if (current != last2) {
    last2 = current;
    zunoSendReport(2);
  }
  current = digitalRead(9);
  if (current != last3) {
    last3 = current;
    zunoSendReport(3);
  }
}

byte getter1() {
  if (last1 == 0)
    return 0xff;
  else
    return 0;
}

byte getter2() {
  if (last2 == 0)
    return 0xff;
  else
    return 0;
}

byte getter3() {
  // petergebruers: blip LED once when getter called... IMHO,
  // this gives a better indication than turning on/off by last3.
  digitalWrite(LED_PIN, 1);
  delayMicroseconds(3000);
  digitalWrite(LED_PIN, 0);

  if (last3 == 0)
    return 0xff;
  else
    return 0;
}
dualarrow
Posts: 6
Joined: 25 Oct 2017 14:32

Re: multiple sensors and vera

Post by dualarrow »

petergebruers,

Tried it and I get the blinks but only when I change the state of pin 9. Theres no other blinking occuring if I dont change state.
petergebruers
Posts: 255
Joined: 26 Jul 2015 17:29

Re: multiple sensors and vera

Post by petergebruers »

Thank you for reporting back. Your result is OK. This means your Z-Uno sends an update to your Vera. If Vera does not report a change, then I am 99,9% certain this is a Vera-thing.

Long shot, but to be on the safe side, did you try exclude and include?

Also, for some controllers it might be an issue with how your controller was added to "association group one" of the Z-Uno. This is something done automatically at inclusion time. I saw it mentioned on this forum, but for an Indigo controller. Unfortunately, I do not know what it looks like on a Vera controller. Does "Multi Channel Association" and "Single Channel Association" ring a bell? It could be on the configuration page of a device, where you set associations.

One other thing, did you notice 4 sensors instead of 3? This is to be expected, it is correct. The first 2 devices should behave in the same way, as if they are duplicates (though technically speaking, they are not duplicates) and reflect the state of D11. Can you notice any difference in reporting, when you short D11 to ground? Note, there is no LED blip code in getter1().

BTW Vera should update, and the LED should blip, if you "poll" or "update" the device, by either clicking a certain button on your Vera interface, or if configure polling at regular intervals. This is not a solution, but it might be interesting to know...
dualarrow
Posts: 6
Joined: 25 Oct 2017 14:32

Re: multiple sensors and vera

Post by dualarrow »

Yes, Each time I compile I make sure I get a clean un-pairing then re-pair the device. Ive found this to be the best to make sure it knows whats on the device.

Also, yes to the 4 sensors. The same occurs when its configured as a switch except the switch works correctly.

I have heard about multi-channel association but dont really know much more about it.
petergebruers
Posts: 255
Joined: 26 Jul 2015 17:29

Re: multiple sensors and vera

Post by petergebruers »

I am, sorry no more wise words, ... I hope someone with a Vera can help you...
dualarrow
Posts: 6
Joined: 25 Oct 2017 14:32

Re: multiple sensors and vera

Post by dualarrow »

Thanks for trying anyway
Black Cat
Posts: 62
Joined: 02 Mar 2016 00:52

Re: multiple sensors and vera

Post by Black Cat »

Vera's biggest failing is that it doesn't handle Multi-Channel Association very well or at all.
I would suggest opening a support ticket with Vera CS about this as it isn't only Z-UNO that is affected but many of the double relay micro switches as well
petergebruers
Posts: 255
Joined: 26 Jul 2015 17:29

Re: multiple sensors and vera

Post by petergebruers »

Black Cat wrote:
11 Nov 2017 01:43
Vera's biggest failing is that it doesn't handle Multi-Channel Association very well or at all.
I would suggest opening a support ticket with Vera CS about this as it isn't only Z-UNO that is affected but many of the double relay micro switches as well
Thank you for confirming my suspicion... Do you know any workaround, like polling the device? I do not want to take any of your time, but if you can spare a minute... Can you tell a Vera noob like me in a few words how to set this up on Vera? I know how it works on Fibaro HC...
User avatar
PoltoS
Posts: 7565
Joined: 26 Jan 2011 19:36

Re: multiple sensors and vera

Post by PoltoS »

Post Reply