Compatibility with Fibaro HC2 - Problem Corrected

Discussion about Z-Uno product. Visit http://z-uno.z-wave.me for more details.
04greg1980
Posts: 20
Joined: 26 Aug 2016 11:43

Compatibility with Fibaro HC2 - Problem Corrected

Post by 04greg1980 » 18 Oct 2016 23:02

Hello,
I have a problem of compatibility between z-uno and Fibaro HC2 v 4.100.
Only one channel are seen by HC2. Do you think it's a problem with z-uno software or I need to contact fibaro?
Thanks a lot
Greg
Last edited by 04greg1980 on 08 Mar 2017 20:06, edited 1 time in total.

p0lyg0n1
Posts: 167
Joined: 04 Aug 2016 07:14

Re: Compatibility with Fibaro HC2

Post by p0lyg0n1 » 19 Oct 2016 12:54

Hello,
Can you give more details to us?
What sketch do you use?
We can try this with our HC2.

04greg1980
Posts: 20
Joined: 26 Aug 2016 11:43

Re: Compatibility with Fibaro HC2

Post by 04greg1980 » 20 Oct 2016 00:34

Hello,
When I use the sketch "Certified 10 Channels", as if some channels are not correctly recognize by Fibaro HC2, the 10 channels appear into the interface.
But I have modified this sketch to use only 10 door sensors.
The sketch is:

Code: Select all

/* 
 * This scretch was certified by the Z-Wave Alliance as one of the two reference Z-Uno sketches.
 * 
 * 10 door sensor
 * 
 */

// Pins definitions
#define DoorPin1 1
#define DoorPin2 2
#define DoorPin3 3
#define DoorPin4 4
#define DoorPin5 5
#define DoorPin6 6
#define DoorPin7 7
#define DoorPin8 8
#define DoorPin9 9
#define DoorPin10 10

#define SWITCH_ON 0xff
#define SWITCH_OFF 0

// Global variables to store data reported via getters
byte lastDoorValue1 = 0;
byte lastDoorValue2 = 0;
byte lastDoorValue3 = 0;
byte lastDoorValue4 = 0;
byte lastDoorValue5 = 0;
byte lastDoorValue6 = 0;
byte lastDoorValue7 = 0;
byte lastDoorValue8 = 0;
byte lastDoorValue9 = 0;
byte lastDoorValue10 = 0;

ZUNO_SETUP_SLEEPING_MODE(ZUNO_SLEEPING_MODE_ALWAYS_AWAKE);

ZUNO_SETUP_ASSOCIATIONS(ZUNO_ASSOCIATION_GROUP_SET_VALUE); // Send Basic Set to association group

// Set up 10 channels
ZUNO_SETUP_CHANNELS(
  ZUNO_SENSOR_BINARY_DOOR_WINDOW(getterDoor1),
  ZUNO_SENSOR_BINARY_DOOR_WINDOW(getterDoor2),
  ZUNO_SENSOR_BINARY_DOOR_WINDOW(getterDoor3),
  ZUNO_SENSOR_BINARY_DOOR_WINDOW(getterDoor4),
  ZUNO_SENSOR_BINARY_DOOR_WINDOW(getterDoor5),
  ZUNO_SENSOR_BINARY_DOOR_WINDOW(getterDoor6),
  ZUNO_SENSOR_BINARY_DOOR_WINDOW(getterDoor7),
  ZUNO_SENSOR_BINARY_DOOR_WINDOW(getterDoor8),
  ZUNO_SENSOR_BINARY_DOOR_WINDOW(getterDoor9),
  ZUNO_SENSOR_BINARY_DOOR_WINDOW(getterDoor10)
);


void setup() {
  // set up I/O pins. Analog and PWM will be automatically set up on analogRead/analogWrite functions call
  pinMode(DoorPin1, INPUT_PULLUP);
  pinMode(DoorPin2, INPUT_PULLUP);
  pinMode(DoorPin3, INPUT_PULLUP);
  pinMode(DoorPin4, INPUT_PULLUP);
  pinMode(DoorPin5, INPUT_PULLUP);
  pinMode(DoorPin6, INPUT_PULLUP);
  pinMode(DoorPin7, INPUT_PULLUP);
  pinMode(DoorPin8, INPUT_PULLUP);
  pinMode(DoorPin9, INPUT_PULLUP);
  pinMode(DoorPin10, INPUT_PULLUP);
}

void loop() {
  byte currentDoorValue1;
  byte currentDoorValue2;
  byte currentDoorValue3;
  byte currentDoorValue4;
  byte currentDoorValue5;
  byte currentDoorValue6;
  byte currentDoorValue7;
  byte currentDoorValue8;
  byte currentDoorValue9;
  byte currentDoorValue10;

  // Door/Window sensor
  currentDoorValue1 = digitalRead(DoorPin1); 
  if (currentDoorValue1 != lastDoorValue1) { 
    lastDoorValue1 = currentDoorValue1;
    zunoSendReport(1);
  }
  currentDoorValue2 = digitalRead(DoorPin2); 
  if (currentDoorValue2 != lastDoorValue2) { 
    lastDoorValue2 = currentDoorValue2;
    zunoSendReport(2);
  }
  currentDoorValue3 = digitalRead(DoorPin3); 
  if (currentDoorValue3 != lastDoorValue3) { 
    lastDoorValue3 = currentDoorValue3;
    zunoSendReport(3);
  }
  currentDoorValue4 = digitalRead(DoorPin4); 
  if (currentDoorValue4 != lastDoorValue4) { 
    lastDoorValue4 = currentDoorValue4;
    zunoSendReport(4);
  }
  currentDoorValue5 = digitalRead(DoorPin5); 
  if (currentDoorValue5 != lastDoorValue5) { 
    lastDoorValue5 = currentDoorValue5;
    zunoSendReport(5);
  }
  currentDoorValue6 = digitalRead(DoorPin6); 
  if (currentDoorValue6 != lastDoorValue6) { 
    lastDoorValue6 = currentDoorValue6;
    zunoSendReport(6);
  }
  currentDoorValue7 = digitalRead(DoorPin7); 
  if (currentDoorValue7 != lastDoorValue7) { 
    lastDoorValue7 = currentDoorValue7;
    zunoSendReport(7);
  }
  currentDoorValue8 = digitalRead(DoorPin8); 
  if (currentDoorValue8 != lastDoorValue8) { 
    lastDoorValue8 = currentDoorValue8;
    zunoSendReport(8);
  }
  currentDoorValue9 = digitalRead(DoorPin9); 
  if (currentDoorValue9 != lastDoorValue9) { 
    lastDoorValue9 = currentDoorValue9;
    zunoSendReport(9);
  }
 currentDoorValue10 = digitalRead(DoorPin10); 
  if (currentDoorValue10 != lastDoorValue10) { 
    lastDoorValue10 = currentDoorValue10;
    zunoSendReport(10);
  }
}

// Getters and setters

byte getterDoor1(void) {
  return lastDoorValue1 ? 0xff : 0;
  }
byte getterDoor2(void) {
  return lastDoorValue2 ? 0xff : 0;
  }
byte getterDoor3(void) {
  return lastDoorValue3 ? 0xff : 0;
  }
byte getterDoor4(void) {
  return lastDoorValue4 ? 0xff : 0;
  }
byte getterDoor5(void) {
  return lastDoorValue5 ? 0xff : 0;
  }
byte getterDoor6(void) {
  return lastDoorValue6 ? 0xff : 0;
  }
byte getterDoor7(void) {
  return lastDoorValue7 ? 0xff : 0;
  }
byte getterDoor8(void) {
  return lastDoorValue8 ? 0xff : 0;
  }
byte getterDoor9(void) {
  return lastDoorValue9 ? 0xff : 0;
  }
byte getterDoor10(void) {
  return lastDoorValue10 ? 0xff : 0;
}
Then I have only one door sensor recognize on HC2 interface.

What-is the problem?
Thanks a lot
Greg

p0lyg0n1
Posts: 167
Joined: 04 Aug 2016 07:14

Re: Compatibility with Fibaro HC2

Post by p0lyg0n1 » 20 Oct 2016 13:36

Hi, Greg.
I try your sketch and found some logic errors and fix them. But it works right with Z-Way (Razberry). It shows all 10 channels.
I will try it with our HC later. The sketch may be simplified if we use arrays(please fix your pins only):

Code: Select all

/* 
 * This scretch was certified by the Z-Wave Alliance as one of the two reference Z-Uno sketches.
 * 
 * 10 door sensor
 * 
 */


#define SWITCH_ON 0xff
#define SWITCH_OFF 0


ZUNO_SETUP_SLEEPING_MODE(ZUNO_SLEEPING_MODE_ALWAYS_AWAKE);

ZUNO_SETUP_ASSOCIATIONS(ZUNO_ASSOCIATION_GROUP_SET_VALUE); // Send Basic Set to association group

// Set up 10 channels
ZUNO_SETUP_CHANNELS(
  ZUNO_SENSOR_BINARY_DOOR_WINDOW(getterDoor1),
  ZUNO_SENSOR_BINARY_DOOR_WINDOW(getterDoor2),
  ZUNO_SENSOR_BINARY_DOOR_WINDOW(getterDoor3),
  ZUNO_SENSOR_BINARY_DOOR_WINDOW(getterDoor4),
  ZUNO_SENSOR_BINARY_DOOR_WINDOW(getterDoor5),
  ZUNO_SENSOR_BINARY_DOOR_WINDOW(getterDoor6),
  ZUNO_SENSOR_BINARY_DOOR_WINDOW(getterDoor7),
  ZUNO_SENSOR_BINARY_DOOR_WINDOW(getterDoor8),
  ZUNO_SENSOR_BINARY_DOOR_WINDOW(getterDoor9),
  ZUNO_SENSOR_BINARY_DOOR_WINDOW(getterDoor10)
);


// Pins definitions

byte door_pins[] = {0, 1, 2, 3, 4, 5, 6, 9, 10, 11};

// Global variables to store data reported via getters
byte lastDoorValue[]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

#define DOOR_GETTER(N)  (lastDoorValue[N-1] ? 0 : 0xFF)

void setup() {
  // set up I/O pins. Analog and PWM will be automatically set up on analogRead/analogWrite functions call

  byte i;

  for(i=0;i<sizeof(door_pins);i++)
    pinMode(door_pins[i], INPUT_PULLUP);

   // // DEBUG VIA Serial1 
   // Serial1.begin(115200); 
   // Serial1.println("Started!");  
}

void loop() {

  byte i;

  for(i=0;i<sizeof(door_pins);i++)
  {
     byte cv = (digitalRead(door_pins[i]) != 0);
     if(cv != lastDoorValue[i])
     {
         lastDoorValue[i] = cv ;
         zunoSendReport(1+i);
         /*
         // DEBUG VIA Serial1
         Serial1.print("Channel ");
         Serial1.print(i+1);
         Serial1.print("changed to  ");
         Serial1.println(cv);
         */
         
     }
  }

  delay(100); // some delay to give some time to main firmware
}

// Getters and setters

byte getterDoor1(void) {
  return DOOR_GETTER(1);
  }
byte getterDoor2(void) {
  return DOOR_GETTER(2);
  }
byte getterDoor3(void) {
  return DOOR_GETTER(3);
  }
byte getterDoor4(void) {
  return DOOR_GETTER(4);
  }
byte getterDoor5(void) {
  return DOOR_GETTER(5);
  }
byte getterDoor6(void) {
  return DOOR_GETTER(6);
  }
byte getterDoor7(void) {
  return DOOR_GETTER(7);
  }
byte getterDoor8(void) {
  return DOOR_GETTER(8);
  }
byte getterDoor9(void) {
  return DOOR_GETTER(9);
  }
byte getterDoor10(void) {
  return DOOR_GETTER(10);
}

04greg1980
Posts: 20
Joined: 26 Aug 2016 11:43

Re: Compatibility with Fibaro HC2

Post by 04greg1980 » 20 Oct 2016 22:32

Hello,
Thanks for this better code.
But I have tried and I have only one door sensor recognize into HC2 like in my precedent post.
If you can try in your HC2?
Thanks a lot.
Greg

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

Re: Compatibility with Fibaro HC2

Post by PoltoS » 22 Oct 2016 12:35

We have planned to make a "hack" for HC2 this summer. But we waited for 4.100 release to test. Seems Fibaro have not fixed that and we need to make the hack. Hope we do it for the next release.

04greg1980
Posts: 20
Joined: 26 Aug 2016 11:43

Re: Compatibility with Fibaro HC2

Post by 04greg1980 » 23 Oct 2016 11:03

Hello,
Thanks a lot for the futur "hack".
I will wait next version. Have good job.
Se you son.
Greg

04greg1980
Posts: 20
Joined: 26 Aug 2016 11:43

Re: Compatibility with Fibaro HC2

Post by 04greg1980 » 05 Nov 2016 22:26

Hello,
Have you an idea When the next version will be out ? And if you think if you have prepare the hack for HC2?
Thanks a lot
Greg

rusboy
Posts: 1
Joined: 06 Nov 2016 15:22

Re: Compatibility with Fibaro HC2

Post by rusboy » 06 Nov 2016 15:35

Добрый день!
Все выходные посвятил попыткам "подружить" HC2 и Z-Uno, но все впустую.
HC2 не видит больше одного бинарного сенсора!
т.е. объявив два канала (и более):
ZUNO_SENSOR_BINARY_DOOR_WINDOW(getterDoor)
ZUNO_SENSOR_BINARY_MOTION(getterMotion)
всегда виден только один - первый.
Я уже больше года жду, когда разработчики сделают рабочий девайс, но к сожалению ....
Скажите пожалуйста хотябы примерные сроки исправления. Положу на это время z-uno на полку.

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

Re: Compatibility with Fibaro HC2

Post by PoltoS » 13 Nov 2016 13:05

@04greg1980 We plan next release with the hack for second part of November. But we need to check first with new HC2 firmware.

@rusboy Летом работало, но вышла новая версия от Fibaro, и в ней опять всё поломали. Увы, мы не можем под них подстраиваться, а Fibaro вечно выпускает прошивки, ломающие совместимость. Стараемся как можем.

Post Reply