aranet-cli 0.1.8

Command-line interface for Aranet environmental sensors
Documentation

aranet-cli

Command-line interface for Aranet environmental sensors.

A fast, scriptable CLI for reading sensor data, downloading history, and configuring Aranet devices (Aranet4, Aranet2, AranetRn+, Aranet Radiation).

Installation

cargo install aranet-cli

Or build from source:

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

Usage

Scan for devices

aranet scan

Read current measurements

aranet read --device <DEVICE_ADDRESS>

Download measurement history

aranet history --device <DEVICE_ADDRESS>
aranet history --device <DEVICE_ADDRESS> --count 100 --format csv --output history.csv

# Filter by date range
aranet history --device <DEVICE_ADDRESS> --since 2026-01-15 --until 2026-01-16

Read from multiple devices

# Specify multiple devices
aranet read -d device1 -d device2

# Or comma-separated
aranet read -d living-room,bedroom,office

Passive read mode

# Read from BLE advertisements without connecting (requires Smart Home enabled)
aranet read --device <DEVICE_ADDRESS> --passive

Watch real-time data

# Watch a specific device
aranet watch --device <DEVICE_ADDRESS> --interval 60

# Watch all devices passively (requires Smart Home enabled)
aranet watch --passive

# Watch a specific device passively
aranet watch --passive --device <DEVICE_ADDRESS>

View device information

aranet info --device <DEVICE_ADDRESS>

Configure device settings

aranet set --device <DEVICE_ADDRESS> interval 5
aranet set --device <DEVICE_ADDRESS> range extended

Manage device aliases

# Create an alias for a device
aranet alias set living-room AA:BB:CC:DD:EE:FF

# List all aliases
aranet alias list

# Use aliases instead of addresses
aranet read -d living-room

# Remove an alias
aranet alias remove living-room

Diagnose BLE issues

aranet doctor

Sync history to local database

# Sync device history (incremental - only new records)
aranet sync --device <DEVICE_ADDRESS>

# Full sync (re-download all history)
aranet sync --device <DEVICE_ADDRESS> --full

Query cached data

# List cached devices
aranet cache devices

# Show cache statistics
aranet cache stats

# Query cached history
aranet cache history --device <DEVICE_ADDRESS> --count 100

# Show database info
aranet cache info

Pressure units

# Display pressure in inches of mercury
aranet read --device <DEVICE_ADDRESS> --inhg

# Explicitly use hPa (default)
aranet read --device <DEVICE_ADDRESS> --hpa

Configuration

The CLI supports persistent configuration via a TOML file:

# Initialize config file
aranet config init

# Set a default device
aranet config set device <DEVICE_ADDRESS>

# Set default output format
aranet config set format json

# Show current config
aranet config show

Configuration options:

  • device — Default device address
  • format — Default output format (text, json, csv)
  • timeout — Connection timeout in seconds
  • no_color — Disable colored output
  • fahrenheit — Use Fahrenheit for temperature display
  • inhg — Use inHg for pressure display
  • bq — Use Bq/m3 for radon (instead of pCi/L)

Output Formats

Format Description
text Human-readable colored output (default)
json JSON for scripting and APIs
csv CSV for spreadsheets and data analysis
aranet read --device <DEVICE> --format json
aranet read --device <DEVICE> --json    # shorthand

Visual Styling

The CLI uses rich styling by default with color-coded values, spinners, and table formatting.

Style Modes

Mode Description
rich Full styling with tables, spinners, colored values (default)
minimal Colors only, no tables or spinners
plain No styling, suitable for scripting
# Use minimal styling
aranet read --device <DEVICE> --style minimal

# Plain output for scripts
aranet history --device <DEVICE> --style plain

# Set via environment variable
export ARANET_STYLE=minimal

Color-Coded Values

Sensor readings are color-coded based on thresholds:

Metric Green Yellow Red
CO2 < 800 ppm 800-1000 ppm > 1000 ppm
Radon < 100 Bq/m3 100-150 Bq/m3 > 150 Bq/m3
Battery > 50% 20-50% < 20%
Humidity 30-60% Outside range -

Brief Mode

Get a compact one-line status:

aranet status --device <DEVICE> --brief
# Output: Aranet4 17C3C: 800 ppm [GREEN] | 22.5C | 45% | 85%

Shell Completions

Generate shell completions for your preferred shell:

aranet completions bash > ~/.local/share/bash-completion/completions/aranet
aranet completions zsh > ~/.zfunc/_aranet
aranet completions fish > ~/.config/fish/completions/aranet.fish

TUI Dashboard

Launch the interactive terminal dashboard:

aranet tui

The TUI provides real-time monitoring with sparkline charts, threshold alerts, multi-device support, and more. See aranet-tui for the complete feature list and keybindings.

Related Crates

This CLI is part of the aranet workspace:

Crate crates.io Description
aranet-core crates.io Core BLE library for device communication
aranet-types crates.io Shared types for sensor data
aranet-store crates.io Local data persistence
aranet-tui crates.io Terminal UI dashboard
aranet-service - Background collector and REST API
aranet-gui - Desktop application (planned)
aranet-wasm - WebAssembly module (planned)

License

MIT


Made with ❤️ by Cameron Rye