ZUNO_BLINDS()
This macro is used to setup multilevel switch channel with type blinds for Z-Uno board using ZUNO_SETUP_CHANNELS.
Z-Uno understands two ways to define a channel: using getter function and using a variable.
-
With getter definition the getter function is called each time a value is requested. This allows to do some calculus before returning a value.
-
With variable definition Z-Uno will automatically return the variable status. This allows to minimize your code.
ZUNO_BLINDS(getter, setter)
getter
pointer to a user defined function, which is supposed to return current value for this channel.
setter
pointer to a user defined function, which is called when new value is received for this channel. Setter function will accept one parameter with values from 0 (closed) to 99 (open)
Functions getter should return 0-99, where 0 is Closed and 99 is Open
BYTE getter(void)
Functions setter accepts values 0-99 (0 is Closed, 99 is Open) and 255 (usually means Open to the previous level, this behavior can be different depending on user sketch)
void setter(BYTE value)
Channel generated using this macro will have Z-Wave Device Class GENERIC_TYPE_SWITCH_MULTILEVEL / SPECIFIC_TYPE_MOTOR_MULTIPOSITION with Switch Multilevel Command Class.
This type is allowed only in ZUNO_SLEEPING_MODE_ALWAYS_AWAKE power mode (see ZUNO_SETUP_SLEEPING_MODE).
ZUNO_SETUP_CHANNELS(ZUNO_BLINDS(getterFunction, setterFunction))
void setup() {
...
}
void loop() {
...
}
BYTE getterFunction() {
return currentValue;
}
void setterFunction(BYTE newValue) {
...
}
ZUNO_BLINDS(variable, NULL)
variable
variable that storeas the current value for this channel. 0-99, where 0 is Closed and 99 is Open
Variable change can be detected using function zunoIsChannelUpdated(channelNum).
ZUNO_SETUP_CHANNELS(ZUNO_BLINDS(shadesLevel, NULL))
byte shadesLevel = 0;
void setup() {
...
}
void loop() {
...
shadesLevel = ...;
...
}