Skip to content

cameronrye/aranet

Repository files navigation

Aranet

Rust implementation for Aranet environmental sensors.

Connect to your Aranet devices via Bluetooth LE to read measurements, download history, and monitor air quality.

CI codecov crates.io docs.rs License: MIT Rust

Features

  • aranet-core — Core BLE library supporting Aranet4, Aranet2, AranetRn+ (Radon), and Aranet Radiation sensors
    • Current readings (CO₂, temperature, pressure, humidity, radon, radiation)
    • Historical data download with timestamps and resumable checkpoints
    • Device settings (measurement interval, Bluetooth range)
    • Auto-reconnection with configurable backoff and retry policies
    • Real-time streaming and event system
    • Passive monitoring via BLE advertisements (no connection required)
    • Platform-specific configuration (macOS, Linux, Windows)
    • Bluetooth diagnostics and troubleshooting utilities
    • BLE adapter serialization with semaphore-based locking
    • Automatic BlueZ agent registration on Linux to prevent BLE pairing hangs
  • aranet-cli — Command-line interface for quick readings and data export
    • Multi-device reading with parallel connections
    • Interactive device picker, device aliases
    • Passive reading from BLE advertisements
    • Progress bars for history download
    • --since/--until date filters, --inhg pressure unit
    • Local data caching with sync, cache, and report commands
  • aranet-store — Local SQLite-based data persistence
    • Incremental history sync (download only new records)
    • Query cached data without device connection
    • Automatic deduplication of history records
  • aranet-tui — Terminal UI dashboard for real-time monitoring
    • Multi-device monitoring with auto-refresh
    • Sparkline charts with min/max labels
    • CO2/radon threshold alerts with audio bell
    • Light/dark theme, mouse support, vim keybindings
    • Export history to CSV, comparison view
    • Device filter, alias management, settings editing
  • aranet-gui — Desktop application built with egui
    • Multi-panel interface with device list, detail, history, comparison views
    • Alert system with threshold management
    • Export to CSV/JSON, system tray, light/dark themes
    • Service management panel for aranet-service control
  • aranet-service — Background daemon with REST API and integrations
    • HTTP API for devices, readings, history queries
    • WebSocket real-time streaming
    • Prometheus metrics endpoint (/metrics) with detailed health checks
    • MQTT publisher for IoT integration and Home Assistant auto-discovery
    • System service management (install/start/stop as launchd/systemd service)
    • Webhook notifications for CO₂/radon/battery threshold alerts (Slack/Discord/PagerDuty)
    • InfluxDB v2 real-time export via line protocol
    • mDNS service discovery (_aranet._tcp.local.)
    • Pre-built Grafana dashboard template
    • Built-in web dashboard with live sparklines, history charts, and service status
    • Staleness detection on current readings (age_seconds, stale)

Screenshots

CLI TUI GUI
CLI Demo TUI Demo GUI

Installation

Install the CLI with Homebrew:

brew tap cameronrye/aranet
brew install aranet

Or use the release installer scripts:

# macOS and Linux
curl --proto '=https' --tlsv1.2 -LsSf \
  https://github.com/cameronrye/aranet/releases/latest/download/aranet-cli-installer.sh | sh

# Windows
irm https://github.com/cameronrye/aranet/releases/latest/download/aranet-cli-installer.ps1 | iex

Or install from crates.io:

cargo install aranet-cli

This installs the aranet executable.

Or run with Docker:

docker compose up -d
# Dashboard: http://localhost:8080/dashboard

Or build from source:

git clone https://github.com/cameronrye/aranet.git
cd aranet
cargo build --release

Using as a Library

Add aranet-core to your Cargo.toml:

[dependencies]
aranet-core = "0.2"

Quick Start

Scan for devices

aranet scan

Read current measurements

aranet read --device <DEVICE_ADDRESS>

Download measurement history

aranet history --device <DEVICE_ADDRESS> --output history.csv

View device information

aranet info --device <DEVICE_ADDRESS>

Read from multiple devices

aranet read -d device1 -d device2
aranet read -d living-room,bedroom  # using aliases

Manage device aliases

aranet alias set living-room AA:BB:CC:DD:EE:FF
aranet alias list
aranet read -d living-room

Generate cached reports

aranet report --device living-room --period weekly
aranet report --all --format json

Start the background service and dashboard

aranet server --bind 127.0.0.1:8080
# Dashboard: http://127.0.0.1:8080/dashboard

Diagnose BLE issues

aranet doctor

Project Structure

aranet/
├── crates/
│   ├── aranet-types/    # Platform-agnostic types (shared)
│   ├── aranet-core/     # Core BLE library
│   ├── aranet-store/    # Local SQLite data persistence
│   ├── aranet-service/  # Background service + REST API
│   ├── aranet-cli/      # CLI tool
│   ├── aranet-tui/      # Terminal dashboard
│   └── aranet-gui/      # Desktop GUI (egui)
├── docker/              # Docker Compose stack (Prometheus + Grafana)
├── grafana/             # Pre-built Grafana dashboard template
└── docs/                # Protocol documentation

Supported Devices

Device Sensors Current History Status
Aranet4 CO₂, Temperature, Pressure, Humidity Yes Yes Fully tested
Aranet2 Temperature, Humidity Yes Yes Supported
AranetRn+ (Radon) Radon, Temperature, Pressure, Humidity Yes Yes Fully tested
Aranet Radiation Dose Rate, Total Dose Yes Partial Supported (history not yet implemented)

Requirements

  • Rust 1.90+
  • Bluetooth adapter with BLE support
  • Platform support:
    • macOS
    • Linux (with BlueZ)
    • Windows

Contributing

Contributions are welcome! Please check the open issues for areas where you can help.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Looking to Contribute?

Here are some features and improvements that would be great additions to the project:

Feature Description Difficulty
Aranet2 history download Implement history data retrieval for Aranet2 devices Medium
Aranet Radiation history Complete history download support for Aranet Radiation sensors Medium
Home Assistant component Native Home Assistant custom component using aranet-core (MQTT integration already available) Medium
Calibration support Add device calibration commands for CO2 sensors Medium
Data visualization Enhanced charting and trend analysis in TUI/GUI Medium

If you're interested in tackling any of these, please open an issue to discuss your approach before starting work. We're happy to provide guidance and answer questions!

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Aranet4-Python - Python implementation that inspired this project
  • btleplug - Cross-platform Bluetooth LE library for Rust

Made with ❤️ by Cameron Rye

This project is not affiliated with, endorsed by, or sponsored by Aranet or SAF Tehnika JSC. Aranet is a trademark of SAF Tehnika JSC.

About

Rust libraries and tools for Aranet environmental sensors (CO₂, temperature, humidity, radon, radiation) via Bluetooth Low Energy

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors