Skip to content

kaanozdokmeci/aranet-radon-sensor-measurement

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Aranet Radon Sensor CLI Utility

Query Aranet Radon Plus Bluetooth sensor for latest radon, temperature, humidity, and pressure measurements.

Requirements

  • Swift 5.5+ (included with Xcode on macOS)
  • Bluetooth enabled on your system
  • Aranet Radon Plus device with "Smart Home Integration" enabled in the Aranet mobile app

Installation

# Build and install to ~/.local/bin
./build.sh

# Ensure ~/.local/bin is in your PATH
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc  # or ~/.bashrc
source ~/.zshrc

Usage

Two Modes of Operation

Default Mode (Fast): Reads data from BLE advertisements without connecting to the device. Returns current readings, interval, and age info.

Full Mode: Connects via GATT to retrieve complete data including 24h/7d/30d radon averages.

First Run (Device Discovery)

aranet-radon --rescan

This will:

  1. Scan for Aranet devices via Bluetooth
  2. Save device info to ~/.config/aranet-radon/device.json
  3. Parse advertisement data and display measurements

Subsequent Runs

# Default: Fast advertisement-based reading (no connection)
aranet-radon

# Full mode: Connect for complete data with averages
aranet-radon --full

Uses saved device from config file (no scanning needed).

JSON Output

aranet-radon --json

# Or with full data
aranet-radon --full --json

Output measurements in JSON format (for Raycast extensions, scripts, etc).

Verbose Mode

aranet-radon --verbose

# Or with full mode
aranet-radon --full --verbose

Shows detailed progress during device scanning and data fetch.

Flags

  • --full - Connect via GATT for complete data including averages (slower but more data)
  • --rescan - Force device discovery and update saved config
  • --json - Output in JSON format
  • --verbose - Show detailed progress messages

Output Examples

Default Mode (Advertisement-based)

Radon:       90 Bq/m³
Temperature: 20.6 °C
Humidity:    43.0 %
Pressure:    864.0 hPa
Battery:     94%
Updated:     502s ago
Interval:    600s

Full Mode (GATT Connection)

Radon:       90 Bq/m³
Temperature: 20.6 °C
Humidity:    43.0 %
Pressure:    864.0 hPa
Battery:     94%

Averages:
  24h: 85 Bq/m³
  7d:  78 Bq/m³
  30d: 72 Bq/m³

JSON Mode (Default)

{
  "battery_percent": 94,
  "humidity_percent": 43.0,
  "interval_s": 600,
  "pressure_hpa": 864.0,
  "radon_bqm3": 90,
  "temperature_c": 20.6,
  "updated_s_ago": 502
}

JSON Mode (Full)

{
  "battery_percent": 94,
  "humidity_percent": 43.0,
  "pressure_hpa": 864.0,
  "radon_24h_avg_bqm3": 85,
  "radon_30d_avg_bqm3": 72,
  "radon_7d_avg_bqm3": 78,
  "radon_bqm3": 90,
  "temperature_c": 20.6
}

Verbose Mode (Advertisement)

Bluetooth adapter ready
Using saved device: AranetRn+ 30622
Scanning for Aranet device advertisements...
Found device: AranetRn+ 30622
Found Aranet device with manufacturer data

Radon:       90 Bq/m³
Temperature: 20.6 °C
Humidity:    43.0 %
Pressure:    864.0 hPa
Battery:     94%
Updated:     502s ago
Interval:    600s

Verbose Mode (Full)

Bluetooth adapter ready
Using saved device: AranetRn+ 30622
Full mode: connecting to device for complete data...
Found saved device: AranetRn+ 30622
Connecting to device AranetRn+ 30622...
Connected successfully
Disconnecting...

Radon:       90 Bq/m³
Temperature: 20.6 °C
Humidity:    43.0 %
Pressure:    864.0 hPa
Battery:     94%

Averages:
  24h: 85 Bq/m³
  7d:  78 Bq/m³
  30d: 72 Bq/m³

Technical Notes

Architecture

  • Native CoreBluetooth framework (macOS)
  • No external dependencies
  • Single ~130KB binary
  • Fast startup (~50ms)
  • Easy deployment (copy to ~/.local/bin)

Device Configuration

Config stored at ~/.config/aranet-radon/device.json:

{
  "uuid": "12345678-90AB-CDEF-1234-567890ABCDEF",
  "name": "AranetRn+ 30622",
  "lastSeen": "2025-10-14T07:27:01.845Z"
}

Note: On macOS, BLE device addresses are often empty due to privacy protections. The utility stores CBPeripheral UUID instead. Devices reconnect successfully using this identifier.

Data Parsing

Advertisement Data (Default Mode):

  • Manufacturer ID: 0x0702 (SAF TEHNIKA)
  • 24-byte manufacturer data after company ID

Advertisement structure:

Bytes 0-1:   Manufacturer ID (0x0702)
Bytes 2-7:   Header (device type, flags, version)
Bytes 8-9:   Radon concentration (uint16, Bq/m³)
Bytes 10-11: Temperature (uint16 × 0.05)
Bytes 12-13: Pressure (uint16 × 0.1)
Bytes 14-15: Humidity (uint16 × 0.1)
Byte 16:     Unknown
Byte 17:     Battery (uint8, %)
Byte 18:     Status (uint8)
Bytes 19-20: Interval (uint16, seconds)
Bytes 21-22: Age (uint16, seconds)
Byte 23:     Counter

GATT Data (Full Mode):

  • 47-byte characteristic (f0cd3003-95da-4f4b-9ac8-aa55d312af0c)

GATT structure:

Bytes 0-5:   Unknown/reserved
Byte 6:      Battery (uint8)
Bytes 7-8:   Temperature (uint16 × 0.05)
Bytes 9-10:  Pressure (uint16 × 0.1)
Bytes 11-12: Humidity (uint16 × 0.1)
Bytes 13-16: Radon current (uint32, Bq/m³)
Byte 17:     Status (uint8)
Bytes 18-21: 24h average period (skip)
Bytes 22-25: Radon 24h average (uint32, Bq/m³)
Bytes 26-29: 7d average period (skip)
Bytes 30-33: Radon 7d average (uint32, Bq/m³)
Bytes 34-37: 30d average period (skip)
Bytes 38-41: Radon 30d average (uint32, Bq/m³)

Troubleshooting

Device not found

  • Ensure device is powered on
  • Enable "Smart Home Integration" in Aranet mobile app
  • Check Bluetooth is enabled
  • Try --rescan flag

Permission errors

  • macOS: Grant Bluetooth permissions in System Settings
  • Linux: Add user to bluetooth group or run with sudo

Project Structure

aranet-radon-sensor-measurement/
├── aranet-radon.swift    # Swift implementation
├── build.sh              # Build and install script
└── README.md

References

About

CLI utility to query Aranet Radon Plus Bluetooth sensor for radon, temperature, humidity, and pressure measurements. Swift and TypeScript implementations.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors