Multiple channels of the same type (and referencing them in Smartthings)

Discussion about Z-Uno product. Visit http://z-uno.z-wave.me for more details.
Post Reply
jemenake
Posts: 1
Joined: 01 Mar 2020 20:50

Multiple channels of the same type (and referencing them in Smartthings)

Post by jemenake »

I'm just starting out with Zuno, and I'm trying to make a device which can control 4 relays. Although I'm sure I could configure the Zuno as a dimmer (and just use the dim-level as a bitmap for which relays should be on/off) or a color bulb (and I still might end up doing it this way, for reasons I'll explain below), I wanted to see if it was possible to do it the "right" way by setting up four channels, all of them ZUNO_SWITCH_BINARY.

In one of the code samples in the quick-start guide, they show how to setup multiple channels:

Code: Select all

ZUNO_SETUP_CHANNELS(
ZUNO_SWITCH_BINARY(getterLED, setterLED),
ZUNO_SWITCH_MULTILEVEL(getterDimmer, setterDimmer),
ZUNO_SENSOR_BINARY_GENERAL_PURPOSE(getterButton)
);
but I noticed that all of the channels are different. It is not clear to me if the multiple channels can be identical (and then the Z-Wave protocol has some way for the controller to address a certain channel by number) or if the protocol only has a way to address certain "capabilities" (i.e. a device either has a single "binary switch" capability or it doesn't, and if it does, a controller asks to talk to that device's "binary switch").

Is it possible to do something like:

Code: Select all

ZUNO_SETUP_CHANNELS(
ZUNO_SWITCH_BINARY(getter1, setter1),
ZUNO_SWITCH_BINARY(getter2, setter2),
ZUNO_SWITCH_BINARY(getter3, setter3)
);
If so...
  • how would you select which switch you wanted to control from a Smartthings device-handler? I can't find any mention of a "channel number" in their methods for constructing a Z-wave message.
  • Is there a way for the getter/setter to discover the channel number they were activated with? If so, you can have multiple channels share a single getter/setter pair (because they can figure out, from the channel number, which switch is being set/queried). Something like:

    Code: Select all

    void setter(byte value) {
      int switch_num = get_channel();
      digitalWrite(switch_num, (value==0)?LOW:HIGH);
    }
    
    If there isn't a way to do this, then it's probably best to have the Zuno pretend to be a dimmer, so that the desired value of all of the relays can be encoded as a bitmap in the dimmer value and you can use a single getter/setter.

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

Re: Multiple channels of the same type (and referencing them in Smartthings)

Post by PoltoS »

You can specify same type of channels many times. You will have multiple switches binded to corresponding getters and setters.

You can also use dynamic channel concept to have all in one handler function. See documentation. But this requires more programming skills.

But please not that new smarthings approach requires you to write device handler to handle channels and map them to controls

C.Scavardo
Posts: 4
Joined: 25 May 2020 20:32

Re: Multiple channels of the same type (and referencing them in Smartthings)

Post by C.Scavardo »

Hi,
Sure, it works for ZUNO_SWITCH_BINARY, I did it, to get/set 2 LEDs linked to the Z-Uno.

Code: Select all

 ZUNO_SETUP_CHANNELS(
  ZUNO_SWITCH_BINARY(getterLed1, setterLed1),
  ZUNO_SWITCH_BINARY(getterLed2, setterLed2)
);
From my Z-Wave controller, the eedomus, I can turn on or turn them off. The status is correctly updated in the eedomus box.

But, my next step was to connect 2 buttons, INPUT_PULLUP mode, to the Z-UNO, using:

Code: Select all

  ZUNO_SETUP_CHANNELS(
                    ZUNO_SENSOR_BINARY(ZUNO_SENSOR_BINARY_TYPE_DOOR_WINDOW,getterButton1),
                    ZUNO_SENSOR_BINARY(ZUNO_SENSOR_BINARY_TYPE_DOOR_WINDOW,getterButton2));
That seems working, when I print to the serial monitor of the IDE, but, it does not work from the Z-Wave controller eedomus point of view.

It works only with 1 channel "ZUNO_SENSOR_BINARY", the status is correctly updated in the Z-Wave controller.
But, when I add a second channel, for a second press button, the Z-Wave controller looks not notified when the button state changed.
When the Z-Wave controller does the polling, the status is correct.
I don't know why the press button state is not automatically updated in the eedomus...
Why does it work with 1 press button, and not with 2...

Gbajolet
Posts: 8
Joined: 29 Apr 2020 13:14

Re: Multiple channels of the same type (and referencing them in Smartthings)

Post by Gbajolet »

Hello, I also find some similar problem with eedomus, I didn’t succeed to add some BINARY SENSOR , nothing appears...
I shall follow your exchanges...
Gilles

Post Reply