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 Examples

Polling mode

PreviousGW ExamplesNextPoll endpoint "/metrics"

Last updated 1 year ago

It is possible to poll the accumulated data from the Ruuvi Gateway via HTTP.

On the "Access Settings" page, enable bearer authentication and set the bearer token:

After that it is possible to poll data using the "/history" endpoint:

curl -v http://<RUUVI_GW_IP>/history 
    -H "Authorization: Bearer Uj+4tj24unVekco/lTLTRyxUfv1J8M6U+sbNsKTWRr0="

The accumulated data will be returned in JSON format: HTTP: Time-stamped data from Bluetooth-sensorsor HTTP: Data from Bluetooth-sensors without timestamps

Example of time-stamped data:

{
  "data": {
    "coordinates": "",
    "timestamp": 1698727580,
    "gw_mac": "F4:D9:16:FE:4F:AD",
    "tags": {
      "E3:75:CF:37:4E:23": {
        "rssi": -51,
        "timestamp": 1698727579,
        "data": "0201061BFF990405164D77BDC74A03FCFF34FFFC87D6DA63CAE375CF374E23",
        "dataFormat": 5,
        "temperature": 28.545,
        "humidity": 76.6325,
        "pressure": 101018,
        "accelX": 1.020,
        "accelY": -0.204,
        "accelZ": -0.004,
        "movementCounter": 218,
        "voltage": 2.686,
        "txPower": -32,
        "measurementSequenceNumber": 25546,
        "id": "E3:75:CF:37:4E:23"
      },
      "F4:1F:0C:28:CB:D6": {
        "rssi": -66,
        "timestamp": 1698727579,
        "data": "0201061BFF99040514F564D7C7B40008FFF403E8B2767A669BF41F0C28CBD6",
        "dataFormat": 5,
        "temperature": 26.825,
        "humidity": 64.5375,
        "pressure": 101124,
        "accelX": 0.008,
        "accelY": -0.012,
        "accelZ": 1.000,
        "movementCounter": 122,
        "voltage": 3.027,
        "txPower": -32,
        "measurementSequenceNumber": 26267,
        "id": "F4:1F:0C:28:CB:D6"
      },
      "C6:A5:B9:E0:AD:06": {
        "rssi": -60,
        "timestamp": 1698727579,
        "data": "0201061BFF99040517C166ACC78C00540004041C8756086435C6A5B9E0AD06",
        "dataFormat": 5,
        "temperature": 30.405,
        "humidity": 65.7100,
        "pressure": 101084,
        "accelX": 0.084,
        "accelY": 0.004,
        "accelZ": 1.052,
        "movementCounter": 8,
        "voltage": 2.682,
        "txPower": -32,
        "measurementSequenceNumber": 25653,
        "id": "C6:A5:B9:E0:AD:06"
      }
    }
  }
}

Also, it is possible to request only raw data without decoding:

curl -v http://<RUUVI_GW_IP>/history?decode=false 
    -H "Authorization: Bearer Uj+4tj24unVekco/lTLTRyxUfv1J8M6U+sbNsKTWRr0="

Example of time-stamped data without decoding:

{
  "data": {
    "coordinates": "",
    "timestamp": 1698727580,
    "gw_mac": "F4:D9:16:FE:4F:AD",
    "tags": {
      "E3:75:CF:37:4E:23": {
        "rssi": -51,
        "timestamp": 1698727579,
        "data": "0201061BFF990405164D77BDC74A03FCFF34FFFC87D6DA63CAE375CF374E23"
      },
      "F4:1F:0C:28:CB:D6": {
        "rssi": -66,
        "timestamp": 1698727579,
        "data": "0201061BFF99040514F564D7C7B40008FFF403E8B2767A669BF41F0C28CBD6"
      },
      "C6:A5:B9:E0:AD:06": {
        "rssi": -60,
        "timestamp": 1698727579,
        "data": "0201061BFF99040517C166ACC78C00540004041C8756086435C6A5B9E0AD06"
      }
    }
  }
}