⬇️ Get the latest Windows Installer
A simple application to control Valve Lighthouse (SteamVR) base stations v2.0 power state via Bluetooth LE.
- Scan for nearby Lighthouse base stations.
- Display discovered stations and their current power state (On/Off/Unknown).
- Toggle the power state of individual base stations.
- Power On/Off all known base stations simultaneously.
- Rename base stations (locally) for easier identification.
- Persistent list of discovered stations across scans (within a single app session).
- Framework: Wails v2
- Backend: Go
- Frontend: Svelte
- Bluetooth: TinyGo Bluetooth Library
- Bluetooth Adapter: You MUST have a working Bluetooth adapter compatible with your OS that supports Bluetooth Low Energy (BLE). Many built-in adapters work, but dedicated USB adapters can sometimes offer better performance/compatibility.
- Go: Version 1.18 or higher.
- Node.js & npm: Required by Wails for frontend dependencies.
- Wails CLI: Install via
go install github.com/wailsapp/wails/v2/cmd/wails@latest. - TinyGo: While the main build uses the standard Go compiler, the
tinygo/bluetoothlibrary is used. Ensure required system dependencies for BLE development are met (e.g., build-essential, libbluetooth-dev on Debian/Ubuntu).
- Clone the repository:
git clone https://github.com/FlameInTheDark/lhcontrol cd lhcontrol - Install frontend dependencies:
Wails typically handles this automatically during the build, but you can run it manually if needed:
cd frontend npm install cd ..
- Development Mode: (Live reload)
wails dev
- Production Build:
This will create an executable in the
wails build
build/bindirectory. Alternatively, for Windows users, a pre-built installer (lhcontrol-amd64-installer.exe) may be available in the project's releases.
- Launch the application.
- Click Scan to discover nearby base stations.
- The application will attempt to connect to discovered stations to determine their power state.
- Use the Toggle Power button next to each station to turn it On or Off.
- Use the Power On All or Power Off All buttons to control all known stations simultaneously.
- Scanning Issues: If scans fail after the first time, or interactions fail with errors like "characteristic not found", try removing the base station(s) from your operating system's Bluetooth device list and restarting your computer. Do not re-pair them in the OS settings; the application will find them via scanning.
- Bluetooth Drivers: Ensure you have the latest drivers for your Bluetooth adapter.
- Permissions: The application might require specific permissions to access Bluetooth hardware.
This application also exposes a simple HTTP API on http://127.0.0.1:7575 for basic control and status monitoring from external scripts or applications.
Endpoints:
-
POST /allon- Description: Attempts to turn ON all known base stations.
- Request Body: None
- Response:
200 OKon success (or if command sent).
-
POST /alloff- Description: Attempts to turn OFF all known base stations.
- Request Body: None
- Response:
200 OKon success (or if command sent).
-
GET /status- Description: Returns the current list of known base stations and their states.
- Request Body: None
- Response:
200 OKwith JSON body:(Power States: -1 = Unknown, 0 = Off, 1 = On)[ { "name": "LHB-STATION1_RENAMED", "originalName": "LHB-XXXXXXXX", "address": "XX:XX:XX:XX:XX:XX", "powerState": 1 }, { "name": "LHB-YYYYYYYY", "originalName": "LHB-YYYYYYYY", "address": "YY:YY:YY:YY:YY:YY", "powerState": 0 } // ... more stations ]
-
POST /scan- Description: Triggers a background scan for base stations (approx. 5s scan + 7s state fetch). The list returned by
/statuswill update once complete. - Request Body: None
- Response:
202 Accepted(indicates the scan has started).
- Description: Triggers a background scan for base stations (approx. 5s scan + 7s state fetch). The list returned by
Example Usage (curl):
# Get current status
curl http://127.0.0.1:7575/status
# Turn all base stations ON
curl -X POST http://127.0.0.1:7575/allon
# Turn all base stations OFF
curl -X POST http://127.0.0.1:7575/alloff