{
  "$schema": "https://apidocs.iqrf.org/iqrf-gateway-daemon/latest/com.iqrftech.self-desc/schema/jsonschema/1-0-0#",
  "title": "IQRF Sensor data - Asynchronous report",
  "type": "object",
  "required": [
    "mType",
    "data"
  ],
  "additionalProperties": false,
  "properties": {
    "mType": {
      "title": "Message type",
      "description": "IQRF Sensor data - ReportAsync response.",
      "type": "string",
      "enum": ["iqrfSensorData_ReportAsync"]
    },
    "data": {
      "title": "Message data",
      "description": "Message metadata and body.",
      "type": "object",
      "required": [
        "msgId",
        "status"
      ],
      "additionalProperties": false,
      "properties": {
        "msgId": {
          "title": "Message ID",
          "description": "Message ID used for pairing requests and responses.",
          "type": "string"
        },
        "rsp": {
          "title": "Response object",
          "description": "Response object.",
          "type": "object",
          "required": [
            "dateTime",
            "unixTime",
            "reportNum",
            "reading"
          ],
          "additionalProperties": false,
          "properties": {
            "dateTime": {
              "title": "Datetime",
              "description": "ISO8601 timestamp of report.",
              "type": "string",
              "format": "date-time"
            },
            "unixTime": {
              "title": "Unix time",
              "description": "Unix timestamp in seconds.",
              "type": "integer",
              "minimum": 0
            },
            "reportNum": {
              "title": "Report number",
              "description": "Number representing report",
              "type": "integer",
              "minimum": 1
            },
            "reading": {
              "title": "Reading data",
              "description": "Sensor data reading in progress.",
              "type": "boolean"
            },
            "devices": {
              "title": "Devices",
              "description": "Array of devices and sensors data.",
              "type": "array",
              "maxItems": 239,
              "items": {
                "title": "Device",
                "description": "Device and sensors data.",
                "type": "object",
                "required": [
                  "address",
                  "hwpid",
                  "mid",
                  "rssi",
                  "sensors"
                ],
                "additionalProperties": false,
                "properties": {
                  "address": {
                    "title": "Device address",
                    "description": "Address of a network device.",
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 239
                  },
                  "hwpid": {
                    "title": "Device HWPID",
                    "description": "Hardware profile of a network device.",
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 65535
                  },
                  "mid": {
                    "title": "Device MID",
                    "description": "Module ID of a network device.",
                    "oneOf": [
                      {
                        "type": "integer",
                        "minimum": 0
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "rssi": {
                    "title": "Device RSSI",
                    "description": "Last RSSI of a network device.",
                    "oneOf": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "sensors": {
                    "title": "Sensors",
                    "description": "Sensor information and values.",
                    "type": "array",
                    "maxItems": 32,
                    "items": {
                      "title": "Sensor",
                      "description": "Sensor information and value.",
                      "type": "object",
                      "required": [
                        "index",
                        "type",
                        "name",
                        "shortName",
                        "unit",
                        "value",
                        "decimalPlaces"
                      ],
                      "additionalProperties": false,
                      "properties": {
                        "index": {
                          "title": "Sensor index",
                          "description": "Index of sensor on device.",
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 31
                        },
                        "type": {
                          "title": "Sensor type",
                          "description": "Numerical value corresponding to sensor type and quantity.",
                          "type": "integer"
                        },
                        "name": {
                          "title": "Quantity name",
                          "description": "Quantity measured by the sensor.",
                          "type": "string"
                        },
                        "shortName": {
                          "title": "Short name",
                          "description": "Shortened quantity name.",
                          "type": "string"
                        },
                        "unit": {
                          "title": "Quantity unit",
                          "description": "Unit in which the quantity is measured.",
                          "type": "string"
                        },
                        "value": {
                          "title": "Value",
                          "description": "Measured value.",
                          "oneOf": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "null"
                            },
                            {
                              "type": "array",
                              "items": {
                                "type": "integer"
                              }
                            }
                          ]
                        },
                        "decimalPlaces": {
                          "title": "Decimal places",
                          "description": "Recommended decimal precision.",
                          "type": "integer",
                          "minimum": 0
                        },
                        "breakdown": {
                          "title": "Sensor breakdowns",
                          "description": "Breakdowns of complex sensor values into parts.",
                          "type": "array",
                          "items": {
                            "title": "Sensor breakdown",
                            "description": "Single simple part of a breakdown.",
                            "type": "object",
                            "required": [
                              "name",
                              "shortName",
                              "unit",
                              "value",
                              "decimalPlaces"
                            ],
                            "additionalProperties": false,
                            "properties": {
                              "name": {
                                "title": "Part name",
                                "type": "string",
                                "minLength": 1
                              },
                              "shortName": {
                                "title": "Part short name",
                                "type": "string",
                                "minLength": 1
                              },
                              "unit": {
                                "title": "Part unit",
                                "type": "string"
                              },
                              "value": {
                                "title": "Part value",
                                "oneOf": [
                                  {
                                    "type": "number"
                                  },
                                  {
                                    "type": "null"
                                  },
                                  {
                                    "type": "array",
                                    "items": {
                                      "type": "integer"
                                    }
                                  }
                                ]
                              },
                              "decimalPlaces": {
                                "title": "Part decimal places",
                                "type": "integer",
                                "minimum": 0
                              },
                              "buttonValue": {
                                "title": "Button label",
                                "description": "This property is only present for breakdown of sensor type Action - Button.",
                                "type": "number"
                              },
                              "valueAsText": {
                                "title": "Text value",
                                "type": "string",
                                "minLength": 1
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "raw": {
          "type": "array",
          "description": "Returns array of objects req-cnf-rsp, see its description.",
          "items": {
            "type": "object",
            "required": [
              "request",
              "requestTs",
              "confirmation",
              "confirmationTs",
              "response",
              "responseTs"
            ],
            "additionalProperties": false,
            "properties": {
              "request": {
                "type": "string",
                "description": "Binary buffer with DPA request."
              },
              "requestTs": {
                "type": "string",
                "description": "YYYY-MM-DDTHH:MM:SS.SSS±HH:MM"
              },
              "confirmation": {
                "type": "string",
                "description": "Binary buffer with DPA confirmation."
              },
              "confirmationTs": {
                "type": "string",
                "description": "YYYY-MM-DDTHH:MM:SS.SSS±HH:MM"
              },
              "response": {
                "type": "string",
                "description": "Binary buffer with DPA response."
              },
              "responseTs": {
                "type": "string",
                "description": "YYYY-MM-DDTHH:MM:SS.SSS±HH:MM"
              }
            }
          }
        },
        "insId": {
          "$id": "#/properties/data/properties/insId",
          "title": "Instance ID",
          "description": "Daemon insteance ID.",
          "type": "string"
        },
        "status": {
          "$id": "#/properties/data/properties/status",
          "title": "Status code",
          "description": "Status code.",
          "type": "integer"
        },
        "statusStr": {
          "$id": "#/properties/data/properties/statusStr",
          "title": "Status string",
          "description": "Verbose status string",
          "type": "string"
        }
      }
    }
  }
}
