ZUNO_START_CONFIG()

This function instructs Z-Uno to start channels and association configuration. Use it to configure your Z-Uno right from the user code. After changing the number or types of channels or association groups Z-Uno must be excluded and included back. Z-Uno will not adopt any channel type change without being excluded. (A debug configuration parameter can disable this restriction). ZUNO_START_CONFIG() Z-Uno dynamic configuration uses the following functions:
  • ZUNO_START_CONFIG(),
  • ZUNO_ADD_CHANNEL(),
  • ZUNO_ADD_ASSOCIATION(),
  • ZUNO_COMMIT_CONFIG(),
  • ZUNO_GET_CONFIG_STATE(),
Do not forget to enable all channel types you will use in your sketch with ZUNO_ENABLE(WITH_CC_...); In runtime you can get channel values using variable g_channels_data. Values of channels are referred via:
  • for one byte channels like SwitchBinary/SwitchMultilevel/SensorBinary/FlowStop/Siren/Doorlock/Blinds: g_channels_data[CH_NUMBER].bParam
  • for Meter/SensorMultilevel depending on the size of the value in the channel: g_channels_data[CH_NUMBER].bParam, g_channels_data[CH_NUMBER].wParam or g_channels_data[CH_NUMBER].dwParam
  • for SwitchColor: g_channels_data[CH_NUMBER].buffParam[color], color is SWITCH_COLOR_COMPONENT_* constant
  • for Thermostat: g_channels_data[CH_NUMBER].thermoParam.mode, g_channels_data[CH_NUMBER].thermoParam.temperature[i], where i = 0 for Heat, i = 1 for Cool, ...
You can check if new value arrived via Z-Wave using zunoIsChannelUpdated(). Good examples of usage of dynamic configuration are Modem example and multiple DS18B20 temperature sensors. More examples in our GitHub repository. Below is the Radio Blink sketch from Z-Uno paper manual made in static getter/setter style
byte dimmerValue = 99;

ZUNO_SETUP_CHANNELS(ZUNO_SWITCH_MULTILEVEL(getSwitchMultilevelValue, setSwitchMultilevelValue));

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  digitalWrite(LED_BUILTIN, HIGH);
  delay(dimmerValue*10);
  digitalWrite(LED_BUILTIN, LOW);
  delay(dimmerValue*10);
}

void setSwitchMultilevelValue(byte newValue) {
  dimmerValue = newValue;
}

byte getSwitchMultilevelValue(void) {
  return dimmerValue;
}
Below is the Radio Blink sketch from Z-Uno paper manual made in static vartiable style
byte dimmerValue = 99;

ZUNO_SETUP_CHANNELS(ZUNO_SWITCH_MULTILEVEL(dimmerValue, NULL));

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  digitalWrite(LED_BUILTIN, HIGH);
  delay(dimmerValue*10);
  digitalWrite(LED_BUILTIN, LOW);
  delay(dimmerValue*10);
}
Below is the Radio Blink sketch from Z-Uno paper manual made in dynamic style
ZUNO_ENABLE(WITH_CC_SWITCH_BINARY);

void setup() {
  ZUNO_START_CONFIG();
  ZUNO_ADD_CHANNEL(ZUNO_SWITCH_MULTILEVEL_CHANNEL_NUMBER, 0, 0);
  ZUNO_COMMIT_CONFIG();

  pinMode(LED_BUILTIN, OUTPUT);
  g_channels_data[0].bParam = 0xFF;
}

void loop() {
  digitalWrite(LED_BUILTIN, HIGH);
  delay(g_channels_data[0].bParam * 10);
  digitalWrite(LED_BUILTIN, LOW);
  delay(g_channels_data[0].bParam * 10);
}