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. Z-Uno understands two ways to define a channel: using getter function and using a variable. 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
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.
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;
}
ZUNO_SENSOR_MULTILEVEL(type, scale_size_precision, variable)
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.
variable
variable that contains the current value for this channel. Variable type (byte, word or dword) should correspond to the size (1, 2 or 4)
ZUNO_SENSOR_MULTILEVEL(ZUNO_SENSOR_MULTILEVEL_TYPE_TEMPERATURE, SENSOR_MULTILEVEL_SCALE_CELSIUS, SENSOR_MULTILEVEL_SIZE_ONE_BYTE, SENSOR_MULTILEVEL_PRECISION_ZERO_DECIMALS, variableTemperature)
byte variableTemperature = 0;
void setup() {
...
}
void loop() {
...
variableTemperature = ...;
...
}
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.
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 or variable)ZUNO_SENSOR_MULTILEVEL_GENERAL_PURPOSE_VALUE(getter or variable)
ZUNO_SENSOR_MULTILEVEL_LUMINANCE(getter or variable)
ZUNO_SENSOR_MULTILEVEL_POWER(getter or variable)
ZUNO_SENSOR_MULTILEVEL_HUMIDITY(getter or variable)
ZUNO_SENSOR_MULTILEVEL_VELOCITY(getter or variable)
ZUNO_SENSOR_MULTILEVEL_DIRECTION(getter or variable)
ZUNO_SENSOR_MULTILEVEL_ATMOSPHERIC_PRESSURE(getter or variable)
ZUNO_SENSOR_MULTILEVEL_BAROMETRIC_PRESSURE(getter or variable)
ZUNO_SENSOR_MULTILEVEL_SOLAR_RADIATION(getter or variable)
ZUNO_SENSOR_MULTILEVEL_DEW_POINT(getter or variable)
ZUNO_SENSOR_MULTILEVEL_RAIN_RATE(getter or variable)
ZUNO_SENSOR_MULTILEVEL_TIDE_LEVEL(getter or variable)
ZUNO_SENSOR_MULTILEVEL_WEIGHT(getter or variable)
ZUNO_SENSOR_MULTILEVEL_VOLTAGE(getter or variable)
ZUNO_SENSOR_MULTILEVEL_CURRENT(getter or variable)
ZUNO_SENSOR_MULTILEVEL_CO2_LEVEL(getter or variable)
ZUNO_SENSOR_MULTILEVEL_AIR_FLOW(getter or variable)
ZUNO_SENSOR_MULTILEVEL_TANK_CAPACITY(getter or variable)
ZUNO_SENSOR_MULTILEVEL_DISTANCE(getter or variable)
ZUNO_SENSOR_MULTILEVEL_ANGLE_POSITION(getter or variable)
ZUNO_SENSOR_MULTILEVEL_ROTATION(getter or variable)
ZUNO_SENSOR_MULTILEVEL_WATER_TEMPERATURE(getter or variable)
ZUNO_SENSOR_MULTILEVEL_SOIL_TEMPERATURE(getter or variable)
ZUNO_SENSOR_MULTILEVEL_SEISMIC_INTENSITY(getter or variable)
ZUNO_SENSOR_MULTILEVEL_SEISMIC_MAGNITUDE(getter or variable)
ZUNO_SENSOR_MULTILEVEL_ULTRAVIOLET(getter or variable)
ZUNO_SENSOR_MULTILEVEL_ELECTRICAL_RESISTIVITY(getter or variable)
ZUNO_SENSOR_MULTILEVEL_ELECTRICAL_CONDUCTIVITY(getter or variable)
ZUNO_SENSOR_MULTILEVEL_LOUDNESS(getter or variable)
ZUNO_SENSOR_MULTILEVEL_MOISTURE(getter or variable)
ZUNO_SENSOR_MULTILEVEL_FREQUENCY(getter or variable)
ZUNO_SENSOR_MULTILEVEL_TIME(getter or variable)