HTTP GET /history (with timestamps) and decoding

Format of time-stamped data returned in response to HTTP request GET /history

The JSON data format description is provided in JSON schema format (https://json-schema.org), which provides clear human- and machine-readable documentation with examples.

The format of relayed raw data from Bluetooth sensors is described here https://docs.ruuvi.com/communication/bluetooth-advertisements

Ruuvi Gateway supports the decoding of some raw data formats. To disable decoding, an additional parameter must be passed in the request: GET /history?decode=false

Decoding of data format 5 (RAWv2) is currently supported: Data format 5 (RAWv2)

{
  "$schema": "https://json-schema.org/draft/2019-09/schema",
  "$id": "http://ruuvi.com/schemas/ruuvi_history.schema.json",
  "type": "object",
  "title": "Accumulated time-stamped data from Bluetooth sensors returned in response to HTTP GET /history",
  "additionalProperties": false,
  "required": [
    "data"
  ],
  "properties": {
    "data": {
      "type": "object",
      "title": "Data-object containing accumulated data from Bluetooth-sensors",
      "additionalProperties": false,
      "required": [
        "coordinates",
        "timestamp",
        "gw_mac",
        "tags"
      ],
      "properties": {
        "coordinates": {
          "type": "string",
          "title": "GPS-coordinates of Ruuvi Gateway (optional)",
          "examples": [
            ""
          ]
        },
        "timestamp": {
          "type": "string",
          "title": "Timestamp (Unix-time) when this JSON is generated by Gateway",
          "examples": [
            "1665742208"
          ]
        },
        "gw_mac": {
          "type": "string",
          "title": "MAC-address of Ruuvi Gateway",
          "examples": [
            "C8:25:2D:8E:9C:2C"
          ]
        },
        "tags": {
          "type": "object",
          "title": "Object containing messages from Bluetooth sensors, with MAC addresses as keys",
          "patternProperties": {
            "^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$": {
              "type": "object",
              "title": "MAC-address of Bluetooth-sensor",
              "additionalProperties": false,
              "required": [
                "rssi",
                "timestamp",
                "data"
              ],
              "properties": {
                "rssi": {
                  "type": "integer",
                  "title": "RSSI",
                  "examples": [
                    -71
                  ]
                },
                "timestamp": {
                  "type": "string",
                  "title": "Timestamp (Unix-time) when the message from Bluetooth-sensor was received by Gateway",
                  "examples": [
                    "1653633986"
                  ]
                },
                "data": {
                  "type": "string",
                  "title": "Relayed message from Bluetooth-sensor in hex encoding",
                  "examples": [
                    "0201061BFF99040513C85714C7CC00240008041CAB76F41C3CC6A5B9E0AD06"
                  ]
                },
                "dataFormat": {
                  "type": "integer",
                  "title": "Data format",
                  "examples": [
                    5,
                    6
                  ]
                },
                "temperature": {
                  "type": "number",
                  "title": "Temperature in C",
                  "examples": [
                    28,
                    28.0,
                    28.745
                  ]
                },
                "humidity": {
                  "type": "number",
                  "title": "Humidity in percentage",
                  "examples": [
                    45,
                    45.3050
                  ]
                },
                "pressure": {
                  "type": "integer",
                  "title": "Pressure in Pa",
                  "examples": [
                    150812
                  ]
                },
                "accelX": {
                  "type": "number",
                  "title": "AccelX",
                  "examples": [
                    0.012,
                    -0.012
                  ]
                },
                "accelY": {
                  "type": "number",
                  "title": "AccelY",
                  "examples": [
                    0.012,
                    -0.012
                  ]
                },
                "accelZ": {
                  "type": "number",
                  "title": "AccelZ",
                  "examples": [
                    0.012,
                    -0.012
                  ]
                },
                "movementCounter": {
                  "type": "integer",
                  "title": "Movement counter",
                  "examples": [
                    0,
                    164
                  ]
                },
                "voltage": {
                  "type": "number",
                  "title": "Battery voltage",
                  "examples": [
                    2.556
                  ]
                },
                "txPower": {
                  "type": "integer",
                  "title": "Tx power",
                  "examples": [
                    -32
                  ]
                },
                "measurementSequenceNumber": {
                  "type": "integer",
                  "title": "Measurement sequence number",
                  "examples": [
                    19807
                  ]
                },
                "id": {
                  "type": "string",
                  "title": "MAC-address of Bluetooth-sensor",
                  "pattern": "^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$",
                  "examples": [
                    "F4:1F:0C:28:CB:D6"
                  ]
                }
              }
            }
          },
          "examples": [
            {
              "F4:1F:0C:28:CB:D6": {
                "rssi": -34,
                "timestamp": "1665742208",
                "data": "0201061BFF99040514EE4C08C5370018FFB803E8A7F6E67A8EF41F0C28CBD6"
              },
              "C6:A5:B9:E0:AD:06": {
                "rssi": -33,
                "timestamp": "1665742208",
                "data": "0201061BFF99040514A24454C4FF0030FFFC0420AB76207A89C6A5B9E0AD06"
              },
              "F4:C6:46:2C:3E:B4": {
                "rssi": -46,
                "timestamp": "1687922292",
                "data": "0201061BFF99040515EF481EC6630038001003F08376502051F4C6462C3EB4",
                "dataFormat": 5,
                "temperature": 28.075,
                "humidity": 46.1550,
                "pressure": 150787,
                "accelX": 0.056,
                "accelY": 0.016,
                "accelZ": 1.008,
                "movementCounter": 80,
                "voltage": 2.651,
                "txPower": -32,
                "measurementSequenceNumber": 8273,
                "id": "F4:C6:46:2C:3E:B4"
              }
            }
          ]
        }
      }
    }
  },
  "examples": [
    {
      "data": {
        "coordinates": "",
        "timestamp": "1665742208",
        "gw_mac": "C8:25:2D:8E:9C:2C",
        "tags": {
          "F4:1F:0C:28:CB:D6": {
            "rssi": -34,
            "timestamp": "1665742208",
            "data": "0201061BFF99040514EE4C08C5370018FFB803E8A7F6E67A8EF41F0C28CBD6"
          },
          "C6:A5:B9:E0:AD:06": {
            "rssi": -33,
            "timestamp": "1665742208",
            "data": "0201061BFF99040514A24454C4FF0030FFFC0420AB76207A89C6A5B9E0AD06"
          }
        }
      }
    },
    {
      "data": {
        "coordinates": "",
        "timestamp": "1687954402",
        "gw_mac": "C8:25:2D:8E:9C:2C",
        "tags": {
          "C6:A5:B9:E0:AD:06": {
            "rssi": -39,
            "timestamp": "1687954402",
            "data": "0201061BFF99040514B637A4C5230030FFF8041894F6DA8FC4C6A5B9E0AD06",
            "dataFormat": 5,
            "temperature": 26.510,
            "humidity": 35.6100,
            "pressure": 150467,
            "accelX": 0.048,
            "accelY": -0.008,
            "accelZ": 1.048,
            "movementCounter": 218,
            "voltage": 2.791,
            "txPower": -32,
            "measurementSequenceNumber": 36804,
            "id": "C6:A5:B9:E0:AD:06"
          },
          "F4:1F:0C:28:CB:D6": {
            "rssi": -47,
            "timestamp": "1687954402",
            "data": "0201061BFF99040515E54395C5630004FFB803E47556AD7E2DF41F0C28CBD6",
            "dataFormat": 5,
            "temperature": 28.025,
            "humidity": 43.2525,
            "pressure": 150531,
            "accelX": 0.004,
            "accelY": -0.072,
            "accelZ": 0.996,
            "movementCounter": 173,
            "voltage": 2.538,
            "txPower": -32,
            "measurementSequenceNumber": 32301,
            "id": "F4:1F:0C:28:CB:D6"
          }
        }
      }
    }
  ]
}

Last updated