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
  • Log read flow
  • Example communication - read temperature
  • Example communication - read all environmental data
  • Data endpoints
  • Full length data
  • Timeout
Edit on GitHub
  1. Communicate with RuuviTag devices via Bluetooth
  2. Bluetooth connection
  3. NUS (Nordic UART Service)

Read logged history

Lifecycle: Beta. Last updated 2020-12-10

Log read flow

The log read is initiated by central which requests for the type of data and time range of the logs. The log is read with command that has a header destination set to physical quantity being read, source to any and type as a log read. The payload is two 32-bit timestamps, seconds since unix epoch. First timestamp is current time, and second time is the lower bound of log data timestamps. For example if the timestamps are 1567047917 and 1566047917 data from time between 2019-08-13 13:18 and 2019-08-29 03:05 is sent.

The logs are sent in format where header destination is the source of read command, source is the physical quantity and type is log write. Payload is 4 bytes of timestamp and 4 bytes of value. Interpretation of value depends on the type of data, possible types are listed below.

When the log buffer is sent and no more data remains, a special message with the entire payload set to 0xFF is sent. It should be noted that there is no way to send only “missing sections” of data from the middle of the logs, logs are always retrieved to the end of the stored data.

Example communication - read temperature

Device

Header

Payload

Description

Central

0x30 30 11

0x5D6740ED 5D57FEAD

“To: temperature. From: temperature. Action: read log data. Clock is 2019-08-29 03:05 now, start from 2019-08-13 13:18”

Peripheral

0x30 30 10

5D57FEAD 000000098D

“To: temperature. From: temperature. Action: write log data. Temperature at 2019-08-13 13:18 24.45 C“

.

.

.

Log entry

.

.

.

Log Entry

Peripheral

0x30 30 10

0x5D6740ED FFFFF8AC

“To: temperature. From: temperature. Action: write log data. Temperature at 2019-08-29 0305 -18.76 C”

Peripheral

0x30 30 10

0xFFFFFFFF FFFFFFFF

“To: temperature. From: temperature. Action: write log data. No more logs”

Example communication - read all environmental data

Device

Header

Payload

Description

Central

0x3A 3A 11

0x5D6740ED 5D57FEAD

“To: environmental. From: environmental. Action: read log data. Clock is 2019-08-29 03:05 now, start from 2019-08-13 13:18”

Peripheral

0x3A 30 10

5D57FEAD 000000098D

“To: environmental. From: temperature. Action: write log data. Temperature at 2019-08-13 13:18 24.45 C“

Peripheral

0x3A 31 10

5D57FEAD 000000098D

“To: environmental. From: humidity. Action: write log data. Humidity at 2019-08-13 13:18 24.45 RH-%“

Peripheral

0x3A 32 10

5D57FEAD 000000098D

“To: environmental. From: pressure. Action: write log data. Pressure at 2019-08-13 13:18 2445 Pa“

.

.

.

Log entry

.

.

.

Log Entry

.

.

.

Log Entry

Peripheral

0x3A 3A 10

0xFFFFFFFF FFFFFFFF

“To: environmental. From: environmental. Action: write log data. No more logs”

Data endpoints

Endpoint byte

Value

Interpretation

0x30

Temperature

int32_t, 0.01 C per LSB

0x31

Humidity

uint32_t, 0.01 RH-% per LSB

0x32

Air pressure

uint32_t, 1 Pa per LSB

0x3A

All environmental values

Special value which can be used to query all environmental data at once.

Full length data

File below is abbreviated nRF Connect log with some heartbeat transmissions and clutter removed. Log read command was added manually

Timeout

If log read takes over 5 minutes, the tag assumes that it has encourtered an internal error and will send error message with header type 0xF0 and payload set to 0xFF, e.g. 0x 30 30 F0 FF FF FF FF FF FF FF FF . It's safe to resume log read by sending a repeated log read command with start timestamp at the last received element.

PreviousHeartbeat transmissionsNextReal Time Transfer (RTT)

Last updated 4 years ago

381KB
v3_28_0_connection.txt
Connection log