Skip to content

atomicflag/lighthouse-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

57 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

lighthouse-manager

Control SteamVR Lighthouse base stations (V1 & V2) via Bluetooth LE from the command line.

Rust Crates.io Docs.rs Minimum Rust Version: 1.85 License

Overview

lighthouse-manager is a Rust CLI tool that lets you discover, power on/off, and identify SteamVR Lighthouse base stations wirelessly via Bluetooth Low Energy. It scans for nearby devices using BLE advertising data, stores them in a local JSON database, and communicates with both Lighthouse V1 (HTC BS-*) and V2 (LHB-*) stations.

Features

  • πŸ” Discover β€” Scan the air for nearby Lighthouse base stations via BLE
  • ⚑ Power On/Off β€” Turn all managed lighthouses on or off in parallel
  • πŸ’‘ Identify (blink) β€” Make a V2 Lighthouse flash its LED by index
  • πŸ’Ύ Persistent storage β€” Database backed by a local JSON file (via XDG dirs)
  • βœ… Cross-platform β€” Linux, macOS, and Windows (requires BLE adapter)
  • πŸ”„ Autostart (SteamVR) β€” Auto-power lighthouses on SteamVR launch, off on exit

Installation

From crates.io (recommended)

cargo install lighthouse-manager

Then run lighthouse-manager --help to verify the installation.

Prebuilt binaries

Download the latest release binary for your platform from GitHub Releases.

From source

git clone https://github.com/atomicflag/lighthouse-manager.git
cd lighthouse-manager
cargo build --release
./target/release/lighthouse-manager --help

Usage

All commands require a working Bluetooth adapter. Run with -v / -vv for debug/trace logs, or set the RUST_LOG environment variable directly.

Discover nearby Lighthouses

Scans for BLE-advertising Lighthouse base stations and saves them to the local database (newly discovered units are marked unmanaged by default):

# Default 10-second scan
lighthouse-manager discover

# Custom scan duration
lighthouse-manager discover -d 20

List known Lighthouses

# Show all lighthouses in the database
lighthouse-manager list

# Show only managed lighthouses
lighthouse-manager list --managed

# Output as pretty JSON
lighthouse-manager list --json

Set managed status

Mark one or all lighthouses as managed or unmanaged. Only managed lighthouses are affected by power-on / power-off.

# Mark a specific lighthouse as managed
lighthouse-manager set-managed 0 true

# Mark a specific lighthouse as unmanaged (ignored by power commands)
lighthouse-manager set-managed 1 false

# Mark all lighthouses in the database as managed
lighthouse-manager set-managed all true

Power On / Off

# Power on all managed lighthouses simultaneously
lighthouse-manager power-on

# Sleep (power off) all managed lighthouses
lighthouse-manager power-off

Identify a Lighthouse (V2 only)

Causes a V2 base station to flash its LED so you can locate it physically:

# Flash the lighthouse at index 0 in the database
lighthouse-manager identify 0

# Alias: same as above
lighthouse-manager blink 0

Autostart (SteamVR)

Automatically turn your lighthouses on when SteamVR starts and power them off when it shuts down. Configure once so you never have to think about base stations again.

# Enable β€” lighthouses turn on when SteamVR launches, off when it exits
lighthouse-manager autostart on

# Disable β€” reverts to manual control only
lighthouse-manager autostart off

Logging

Control verbosity globally with -v / -vv, or use RUST_LOG:

# Equivalent to -v
RUST_LOG=lighthouse_manager=debug lighthouse-manager list

# Trace-level logging for debugging BLE issues
RUST_LOG=lighthouse_manager=trace lighthouse-manager discover

Architecture

src/
β”œβ”€β”€ lib.rs               # Library crate (re-exports modules)
β”œβ”€β”€ cli/                 # CLI binary entry point (clap Parser + subcommand dispatch)
β”‚   └── main.rs
β”œβ”€β”€ ovr/                 # Companion SteamVR binary (auto-launch target)
β”‚   └── main.rs
β”œβ”€β”€ bluetooth.rs         # Bluetooth adapter management via btleplug
β”œβ”€β”€ lighthouse.rs        # Lighthouse device model & version detection
β”œβ”€β”€ protocol.rs          # BLE GATT communication protocol layer
β”œβ”€β”€ storage.rs           # Local JSON database (XDG-compliant paths)
└── commands/
    β”œβ”€β”€ autostart.rs     # Auto-on/off lighthouses when SteamVR starts/stops
    β”œβ”€β”€ discover.rs       # BLE scan β†’ save discovered units
    β”œβ”€β”€ list.rs           # Database listing with filtering
    β”œβ”€β”€ set_managed.rs    # Set managed/unmanaged status by index or "all"
    β”œβ”€β”€ power.rs          # Parallel power on/off via GATT writes
    └── identify.rs       # V2 LED flash via GATT characteristic

Building from Source

Prerequisites

  • Rust 1.85+ (rustup recommended)
  • A Bluetooth 4.0+ adapter (Linux: bluez; macOS / Windows: native BLE stack)

Compile

# Development build (fast iteration)
cargo build

# Release build (optimized, smaller binary)
cargo build --release

Testing

Run the full test suite:

cargo test

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  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

About

Control SteamVR Lighthouse base stations (V1 & V2) via Bluetooth LE from the command line

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages