ZUNO_SENSOR_MULTILEVEL()

This macro is a generic macro to be used to setup multilevel sensor channel for Z-Uno board using ZUNO_SETUP_CHANNELS. Instead we suggest to use one of the specific macro ZUNO_SENSOR_MULTILEVEL_* from the list below. ZUNO_SENSOR_MULTILEVEL(type, scale_size_precision, getter) type type of channel like ZUNO_SENSOR_MULTILEVEL_TYPE_TEMPERATURE, ZUNO_SENSOR_MULTILEVEL_TYPE_DEW_POINT,.. etc. Used to correctly display the sensor in the Z-Wave controller. Full list is defined in ZUNO_Definitions.h and starts with ZUNO_SENSOR_MULTILEVEL_TYPE_ scale_size_precision specific scale used for sensor type, size (1, 2 or 4 bytes) and precision (number of decimals after dot). This should be packed in one byte. Use SENSOR_MULTILEVEL_PROPERTIES_COMBINER() macro to pack. getter pointer to a user defined function, which is supposed to return current value for this channel. SENSOR_MULTILEVEL_PROPERTIES_COMBINER(scale, size, precision) Functions getter should return current value using types BYTE (for size = 1), WORD (for size = 2) or DWORD (for size = 4) depending on size field defined in scale_size_precision parameter. In almost all most used macros the size is 1 and value type is BYTE. BYTE getter(void) Values returned by getter are signed. Values are interpreted according to the following transformation:
  • signed value = value / 10precision, for value < MAX_NUM/2
  • signed value = (value - MAX_NUM) / 10precision, for value ≥ MAX_NUM/2
Where MAX_NUM = 28*size and precision defined number of decimal digits after dot.
For example if size 1 and precision 0, value 25 represents 25,
for size 1 and precision 0, value 164 represents -92 = 164 - 256,
for size 1 and precision 1, value 25 represents 2.5 = 25 / 10,
for size 1 and precision 1, value 164 represents -9.2 = (164 - 256) / 10,
for size 2 and precision 1, value 366 represents 36.6,
for size 2 and precision 1, value 65535 represents -0.1 = (65535 - 65536) / 10,
for size 2 and precision 2, value 65535 represents -0.01 = (65535 - 65536) / 100.
Channel generated using this macro will have Z-Wave Device Class GENERIC_TYPE_SENSOR_MULTILEVEL / SPECIFIC_TYPE_ROUTING_SENSOR_MULTILEVEL with Sensor Multilevel Command Class.
           ZUNO_SENSOR_MULTILEVEL(ZUNO_SENSOR_MULTILEVEL_TYPE_TEMPERATURE, SENSOR_MULTILEVEL_SCALE_CELSIUS, SENSOR_MULTILEVEL_SIZE_ONE_BYTE, SENSOR_MULTILEVEL_PRECISION_ZERO_DECIMALS, GETTER)
           
void setup() {
    ...
}

void loop() {
    ...
}

byte getterFunction() {
    return currentValue;
}
        
    
Popular sensor types have pre-defined macro. Few are listed below. Full list is defined in ZUNO_Definitions.h file and starts with ZUNO_SENSOR_MULTILEVEL_ ZUNO_SENSOR_MULTILEVEL_TEMPERATURE(getter)
ZUNO_SENSOR_MULTILEVEL_GENERAL_PURPOSE_VALUE(getter)
ZUNO_SENSOR_MULTILEVEL_LUMINANCE(getter)
ZUNO_SENSOR_MULTILEVEL_POWER(getter)
ZUNO_SENSOR_MULTILEVEL_HUMIDITY(getter)
ZUNO_SENSOR_MULTILEVEL_VELOCITY(getter)
ZUNO_SENSOR_MULTILEVEL_DIRECTION(getter)
ZUNO_SENSOR_MULTILEVEL_ATMOSPHERIC_PRESSURE(getter)
ZUNO_SENSOR_MULTILEVEL_BAROMETRIC_PRESSURE(getter)
ZUNO_SENSOR_MULTILEVEL_SOLAR_RADIATION(getter)
ZUNO_SENSOR_MULTILEVEL_DEW_POINT(getter)
ZUNO_SENSOR_MULTILEVEL_RAIN_RATE(getter)
ZUNO_SENSOR_MULTILEVEL_TIDE_LEVEL(getter)
ZUNO_SENSOR_MULTILEVEL_WEIGHT(getter)
ZUNO_SENSOR_MULTILEVEL_VOLTAGE(getter)
ZUNO_SENSOR_MULTILEVEL_CURRENT(getter)
ZUNO_SENSOR_MULTILEVEL_CO2_LEVEL(getter)
ZUNO_SENSOR_MULTILEVEL_AIR_FLOW(getter)
ZUNO_SENSOR_MULTILEVEL_TANK_CAPACITY(getter)
ZUNO_SENSOR_MULTILEVEL_DISTANCE(getter)
ZUNO_SENSOR_MULTILEVEL_ANGLE_POSITION(getter)
ZUNO_SENSOR_MULTILEVEL_ROTATION(getter)
ZUNO_SENSOR_MULTILEVEL_WATER_TEMPERATURE(getter)
ZUNO_SENSOR_MULTILEVEL_SOIL_TEMPERATURE(getter)
ZUNO_SENSOR_MULTILEVEL_SEISMIC_INTENSITY(getter)
ZUNO_SENSOR_MULTILEVEL_SEISMIC_MAGNITUDE(getter)
ZUNO_SENSOR_MULTILEVEL_ULTRAVIOLET(getter)
ZUNO_SENSOR_MULTILEVEL_ELECTRICAL_RESISTIVITY(getter)
ZUNO_SENSOR_MULTILEVEL_ELECTRICAL_CONDUCTIVITY(getter)
ZUNO_SENSOR_MULTILEVEL_LOUDNESS(getter)
ZUNO_SENSOR_MULTILEVEL_MOISTURE(getter)
ZUNO_SENSOR_MULTILEVEL_FREQUENCY(getter)
ZUNO_SENSOR_MULTILEVEL_TIME(getter)