ZUNO_REPORTS_HANDLER()

This macro is used to setup up a handler for incoming reports from other sensors. ZUNO_REPORTS_HANDLER(reportHandler) reportHandler pointer to a user defined function that parses the incoming report. void reportHandler(void) There are few helpful marco to parse the reported data inside the report handler:
  • REPORT_TYPE() returns the type of the report: CC_BASIC, CC_SWITCH_BINARY, CC_SWITCH_MULTILEVEL, CC_SENSOR_BINARY, CC_SENSOR_MULTILEVEL, CC_METER, CC_THERMOSTAT_MODE, CC_THERMOSTAT_SETPOINT.
  • REPORT_GROUP_ID() returns the first group containing the sender or 255 if the sender is not present in any group
  • REPORT_NODE_ID() returns the sender Node Id
  • REPORT_VALUE_1B() returns the BYTE value contained in the Switch Binary, Switch Multilevel, Sensor Binary/Notification, Door Lock, Thermostat Mode reports as well as Sensor Multilevel, Meter or Thermostat temperature report with size = 1 bytes
  • REPORT_VALUE_2B() returns the WORD value contained in the Sensor Multilevel, Meter or Thermostat temperature report with size = 2 bytes
  • REPORT_VALUE_4B() returns the DWORD value contained in the Sensor Multilevel, Meter or Thermostat temperature report with size = 4 bytes
  • REPORT_SENSOR_TYPE() returns sensor type
  • REPORT_SENSOR_SCALE() returns sensor scale
  • REPORT_SENSOR_VALUE_UNITS() returns sensor units
  • REPORT_SENSOR_VALUE_PRECISION() returns sensor precision (number of digits after .)
  • REPORT_SENSOR_VALUE_SIZE() returns sensor value size (1, 2 or 4 bytes)
  • REPORT_METER_TYPE() returns meter type
  • REPORT_METER_RATE() returns meter rate
  • REPORT_METER_VALUE_UNITS() returns meter units
  • REPORT_METER_VALUE_PRECISION() returns meter precision (number of digits after .)
  • REPORT_METER_VALUE_SIZE() returns Meter value size (1, 2 or 4 bytes)
If you need to parse the report outside of the report handler, use CLONE_REPORT_DATA(variable) to copy the report data to a variable. Then use EXTRACT_*(variable) macro to extract data from the copy of the report.
Z-Uno will save the highest security level it used to communicate with a devices. The save value will be expected for a report.
        ZUNO_REPORTS_HANDLER(reportHandler);

void reportHandler() {
  ... REPORT_VALUE_1B() ...
}
It is suggested to return as fast as possible from the reports handler and do the main work in the loop().
        ZUNO_REPORTS_HANDLER(reportHandler);

// memory to store the incoming report
REPORT_DATA_TYPE report_data;

void reportHandler() {
  CLONE_REPORT_DATA(report_data);
  ...
}

void loop() {
    ... EXTRACT_REPORT_VALUE_1B(report_data) ...
}