LogoLogo
  • Ruuvi Developer Documentation
  • Ruuvi Hardware
    • RuuviTag B
    • RuuviTag Pro
    • Ruuvi Gateway
    • Ruuvi DevShield
    • Ruuvi Connector Kit
    • TMP 117 External Sensor
  • Ruuvi Connector System
    • Introduction
    • Expansion boards
    • Cables
    • Connectors
  • Ruuvi Sensor Firmware
    • 1.2.12
    • 2.5.9
    • 3.X
      • 3.x Sensors
      • 3.x Heartbeat
    • Device Firmware Update (DFU)
  • Ruuvi Gateway Firmware
    • GW Getting Started
    • GW Web-UI
      • Greeting window
      • Internet connection settings
        • Connection via Wi-Fi
        • Connection via Ethernet
      • Software update
      • Automatic configuration download
      • Automatic updates
      • Access Settings from LAN
      • Cloud Options
        • Backend: HTTP(s)
        • Backend: MQTT(s)
        • Backend: Statistics
      • Time Synchronisation Options
      • Bluetooth Scanning Settings
      • Configuration completion
      • Authentication when accessing from LAN
    • GW Install custom firmware
    • GW nRF52811 Firmware
      • GW nRF52811 selftest
      • GW nRF52811 scanning
      • GW nRF52811 repeating
      • GW nRF52811 UART communication
  • GW ESP32 Firmware
    • GW ESP32 WiFi Hotspot
    • GW ESP32 Button
    • GW ESP32 LED
    • GW ESP32 HTTP Client
    • GW ESP32 MQTT client
  • GW Data formats
    • HTTP: Time-stamped data from Bluetooth-sensors
    • HTTP: Data from Bluetooth-sensors without timestamps
    • MQTT: Time-stamped data from Bluetooth-sensors
    • MQTT: Data from Bluetooth-sensors without timestamps
    • HTTP GET /history (with timestamps) and decoding
    • HTTP: Gateway status
    • Gateway configuration
  • GW Examples
    • Polling mode
    • Poll endpoint "/metrics"
    • Configuration update via API
    • Firmware update via API
    • Configuration download from a remote server via API
    • MQTT examples
    • Home Assistant
    • MQTT+AWS IoT Core
  • Communicate with RuuviTag devices via Bluetooth
    • Bluetooth advertisements
      • Data format 3 (RAWv1)
      • Data format 4 (URL)
      • Data format 5 (RAWv2)
      • Data format C5 (Cut-RAWv2)
      • Data format 8 (Encrypted environmental)
    • Bluetooth connection
      • DIS (Device Information Service)
      • NUS (Nordic UART Service)
        • Heartbeat transmissions
        • Read logged history
    • Real Time Transfer (RTT)
  • Communicate with Ruuvi Cloud
    • Ruuvi Cloud
      • User API
      • Gateway API
      • Internal API
      • Alerts
      • Cloud stored app settings
  • Ruuvi Community projects
    • Integrations
Powered by GitBook
On this page
Edit on GitHub
  1. GW Data formats

HTTP GET /history (with timestamps) and decoding

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

PreviousMQTT: Data from Bluetooth-sensors without timestampsNextHTTP: Gateway status

Last updated 1 year ago

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

The format of relayed raw data from Bluetooth sensors is described here

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"
          }
        }
      }
    }
  ]
}
https://json-schema.org
https://docs.ruuvi.com/communication/bluetooth-advertisements