ZUNO_THERMOSTAT()

This macro is used to setup thermostat channel for Z-Uno board using ZUNO_SETUP_CHANNELS. ZUNO_THERMOSTAT(flags, units, neg_pos, limits, getterMode, setterMode, getterTemp, setterTemp) flags Byte mask with supported modes. There are predefined constants named THERMOSTAT_FLAGS_*. Exact list can be found in ZUNO_Definitions.h. units Use THERMOSTAT_UNITS_CELSIUS for °C and THERMOSTAT_UNITS_FAHRENHEIT for °F. Most controllers will automatically convert reported values to the regional units. neg_pos Defines if only negative, only positive or both negative and positive values should be accepted. Use THERMOSTAT_RANGE_NEG, THERMOSTAT_RANGE_POS or THERMOSTAT_RANGE_NEG | THERMOSTAT_RANGE_POS. limit Sets the limit for values: 0 … limit*10 for THERMOSTAT_RANGE_POS, -limit*10 … 0 for THERMOSTAT_RANGE_NEG and -limit*10 … limit*10 for THERMOSTAT_RANGE_NEG | THERMOSTAT_RANGE_POS. getterMode pointer to a user defined function, which is supposed to return current mode: THERMOSTAT_MODE_OFF, THERMOSTAT_MODE_HEAT, THERMOSTAT_MODE_COOL or THERMOSTAT_MODE_AUTO. setterMode pointer to a user defined function, which is called when new mode is received for this channel. Setter function will accept one parameter with values: THERMOSTAT_MODE_OFF, THERMOSTAT_MODE_HEAT, THERMOSTAT_MODE_COOL or THERMOSTAT_MODE_AUTO getterTemp pointer to a user defined function, which is supposed to return current temperature value of a specified mode for this channel. setterTemp pointer to a user defined function, which is called when new temperature value is received for the specified mode of this channel. Setter function will accept two parameters: BYTE mode and WORD temperature value interpretted depending on channel flags. Functions getterMode should the current mode (see THERMOSTAT_MODE_* in ZUNO_Definitions.h. BYTE getterMode(void) Functions setterMode accepts the new thermostat mode (see THERMOSTAT_MODE_* in ZUNO_Definitions.h. void setterMode(BYTE mode) Functions getterTemp should return WORD (two bytes) representing the temperature for a specified mode. BYTE getterTemp(BYTE mode) Functions setterTemp accepts a WORD representing the new temperature for a specified mode. void setterTemp(BYTE mode, WORD temp) The temperature is represented by a WORD (2 bytes) with one digit precision. This means value 105 = 10.5°, 235 = 23.5°, 300 = 30° etc. Channel generated using this macro will have Z-Wave Device Class GENERIC_TYPE_THERMOSTAT / SPECIFIC_TYPE_THERMOSTAT_GENERAL with Thermostat Mode and Thermostat Setpoint Command Classes.
        ZUNO_SETUP_CHANNELS(ZUNO_THERMOSTAT(THERMOSTAT_FLAGS_OFF|THERMOSTAT_FLAGS_HEAT|THERMOSTAT_FLAGS_COOL, THERMOSTAT_UNITS_CELSIUS, THERMOSTAT_RANGE_NEG|THERMOSTAT_RANGE_POS, 3, getterMode, setterMode, getterTemp, setterTemp));

           
void setup() {
    ...
}

void loop() {
    ...
}

BYTE getterMode() {
    return currentMode;
}

void setterMode(BYTE mode) {
    ...
}

WORD getterTemp(BYTE mode) {
    return currentSetpoint;
}

void setterTemp(BYTE mode, WORD temp) {
    ...
}