Adding multiple elements - include process hanging

Discussions about Z-Way software and Z-Wave technology in general
Post Reply
MUDO
Posts: 3
Joined: 28 Nov 2019 14:15

Adding multiple elements - include process hanging

Post by MUDO » 28 Nov 2019 14:28

Hi guys. Im new here. I want to add more elements with one Zuno. I used example code "Multilevel Sensor" (https://z-uno.z-wave.me/examples/MultilevelSensor/). It works great.

Then I added new element with own channel. This code is supposed to work even new element is just a "copy" of behaviour of the first element. I cant finish include process. It hangs on 95%. I added new element, channel and getter. Editied code is below and all changes are highlighted in bold. Sorry for not putting it as a code style, wanted to use bold and it is not possible there.

Not ecven luck with this channels setup:

Code: Select all

ZUNO_SENSOR_BINARY(ZUNO_SENSOR_BINARY_TYPE_GENERAL_PURPOSE, getter),
ZUNO_SENSOR_BINARY(ZUNO_SENSOR_BINARY_TYPE_GENERAL_PURPOSE, getter2)
HW:
- Raspberry Pi 3+
- RaZberry
- Arduino IDE v1.8.10

Any help please? Im pretty sure, Im missing some detail here and Im too blind to spot it.


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

// button pin number
// 18 pin - button(BTN) of Z-Uno board
#define BTN_PIN 18

// channel number
#define ZUNO_CHANNEL_NUMBER_ONE 1
#define ZUNO_CHANNEL_NUMBER_TWO 2

// variable to store current button state
byte lastButtonState;

ZUNO_SETUP_CHANNELS(
ZUNO_SENSOR_MULTILEVEL_GENERAL_PURPOSE(getter),
ZUNO_SENSOR_MULTILEVEL_GENERAL_PURPOSE(getter2)
);

// the setup routine runs once when you press reset:
void setup() {
pinMode(LED_PIN, OUTPUT); // set LED pin as output
pinMode(BTN_PIN, INPUT_PULLUP); // set button pin as input
}
// the loop routine runs over and over again forever:
void loop() {
// sample current button state
byte currenButtonState = digitalRead(BTN_PIN);

if (currenButtonState != lastButtonState) { // if state changes
lastButtonState = currenButtonState; // save new state
zunoSendReport(ZUNO_CHANNEL_NUMBER_ONE); // send report over the Z-Wave to the controller
zunoSendReport(ZUNO_CHANNEL_NUMBER_TWO); // send report over the Z-Wave to the controller

if (currenButtonState == LOW) { // if button is pressed
digitalWrite(LED_PIN, HIGH); // turn the LED on
} else { // if button is released
digitalWrite(LED_PIN, LOW); // turn the LED off
}
}
}

byte getter() {
if (lastButtonState == 0) { // if button is pressed
return 0xff; // return "Triggered" state to the controller
} else { // if button is released
return 0; // return "Idle" state to the controller
}
}

byte getter2() {
if (lastButtonState == 0) { // if button is pressed
return 0xff; // return "Triggered" state to the controller
} else { // if button is released
return 0; // return "Idle" state to the controller
}
}


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

Re: Adding multiple elements - include process hanging

Post by PoltoS » 02 Dec 2019 03:15

Make sure to re-unclude your device afte changing the channel type. This is a MUST in Z-Wave.

Check the second [!] notice on https://z-uno.z-wave.me/Reference/ZUNO_SETUP_CHANNELS/

If this is not your case, please let us know what is missing in the interview

MUDO
Posts: 3
Joined: 28 Nov 2019 14:15

Re: Adding multiple elements - include process hanging

Post by MUDO » 04 Dec 2019 01:09

Thx for reply. I will check (cant now). I excluded ZUNO before including for sure. Any way how to find out "please let us know what is missing in the interview". Do you mean logs? Thx.

Post Reply