A Prometheus metrics gateway for Axpert solar inverters, providing real-time monitoring and data collection via USB connectivity.
Pull the latest image from GitHub Container Registry:
docker pull ghcr.io/marevers/axpert-gateway:latestRun the container with USB device access:
docker run -d \
--name axpert-gateway \
--device=/dev/hidraw0 \
-p 8080:8080 \
ghcr.io/marevers/axpert-gateway:latest- Go 1.24.6 or later
- Node.js 22 or later (for frontend development)
- libhidapi-dev and libudev-dev (for USB HID support)
- pkg-config
# Clone the repository
git clone https://github.com/marevers/axpert-gateway.git
cd axpert-gateway
# Install Go dependencies (Ubuntu/Debian)
sudo apt-get install pkg-config libhidapi-dev libudev-dev
# Build frontend (required for control interface)
cd frontend
npm install
npx tsc app.ts --target es2017 --lib es2017,dom --outDir .
cd ..
# Build the application
go build -o axpert-gateway .
# Run the application with control API enabled
./axpert-gateway --axpert.control=trueTo cross-compile for Raspberry Pi, you can build using the included build script (requires Docker):
./build.shThe project includes a TypeScript-based frontend located in the frontend/ directory:
# Frontend development
cd frontend
npm install # Install dependencies
npx tsc app.ts --target es2017 --lib es2017,dom --outDir . # Compile TypeScriptFrontend Files:
frontend/app.ts- TypeScript source codefrontend/index.html- Main HTML interfacefrontend/styles.css- CSS stylingfrontend/package.json- npm configuration
The application supports the following command-line flags:
| Flag | Default | Description |
|---|---|---|
--log.level |
info |
Log level for logging (debug, info, warn, error) |
--web.listen-address |
:8080 |
The address to listen on for HTTP requests |
--web.telemetry-path |
/metrics |
Path under which to expose metrics |
--axpert.interval |
30 |
Interval in seconds for data polling |
--axpert.metrics |
true |
Enable/disable metrics collection |
--axpert.control |
false |
Enable/disable control API |
# Run with custom settings
./axpert-gateway \
-log.level=debug \
-web.listen-address=:9090 \
-axpert.interval=60 \
-axpert.control=true/- Landing page with links to available endpoints/metrics- Prometheus metrics endpoint/healthz- Health check endpoint/control/- Web-based control interface (when control API is enabled)/api/inverters- List available inverters (JSON API)/api/command/:command- Execute inverter commands (JSON API)/api/settings- Get current inverter settings (JSON API)
The gateway includes a control API and web interface for managing your Axpert inverters remotely.
Access the web interface at: http://localhost:8080/control/
Features:
- Real-time Settings Display - View current inverter configuration and status
- Multi-inverter Support - Switch between multiple connected inverters
- Output Priority Control - Set output priority
- Charger Priority Control - Set charger priority
Enable the control API with the --axpert.control=true flag.
GET /api/invertersResponse:
{
"inverters": [
{"serialno": "12456789000000"},
{"serialno": "12456789000000"}
],
"count": 2
}POST /api/settings
Content-Type: application/json
{
"serialno": "12456789000000"
}Response:
{
"serialno": "12456789000000",
"settings": {
"outputSourcePriority": "solar",
"chargerSourcePriority": "solarfirst",
"deviceMode": "inverter",
"chargeSource": "solar",
"batteryRechargeVoltage": 48.0,
"batteryRedischargeVoltage": 50.0,
"batteryCutoffVoltage": 44.0,
"batteryFloatVoltage": 54.0
}
}POST /api/command/:command
Content-Type: application/json
{
"value": "solar",
"serialno": "12456789000000"
}Available Commands:
setOutputPriority- Values:utility,solar,sbusetChargerPriority- Values:utilityfirst,solarfirst,solarandutility,solaronlysetBatteryRechgVoltage- Values: whole numbers between44and51setBatteryRedischgVoltage- Values: whole numbers between48and58
Response:
{
"command": "setOutputPriority",
"value": "solar",
"status": "success",
"message": "Command executed successfully"
}# Enable control API and start gateway
./axpert-gateway --axpert.control=true
# Set output priority via API
curl -X POST http://localhost:8080/api/command/setOutputPriority \
-H "Content-Type: application/json" \
-d '{"value": "solar", "serialno": "12456789000000"}'
# Or use the web interface at http://localhost:8080/control/The gateway exposes comprehensive Axpert inverter metrics in Prometheus format, including:
- Power Data - AC/DC input/output power, load percentages
- Battery Status - Voltage levels, charge state, temperature
- Inverter Parameters - Operating mode, priorities, efficiency
- System Health - Device status, warnings, error conditions
Metrics are collected with a serialno label (multiple connected inverters supported) and the collection interval is configurable (default: 30s).
Access metrics at: http://localhost:8080/metrics
- Axpert solar inverter with USB connectivity
- USB cable (typically USB-A to USB-B)
- Linux-based system (Raspberry Pi recommended)
- USB HID support in kernel
Add the following to your prometheus.yml:
scrape_configs:
- job_name: 'axpert-gateway'
static_configs:
- targets: ['localhost:8080']
scrape_interval: 30s
metrics_path: /metricsAn example of a Grafana dashboard can be found in ./dashboard/axpert-grafana.json.
-
USB Permission Denied
# Add user to dialout group sudo usermod -a -G dialout $USER # Or run with appropriate permissions sudo ./axpert-gateway
-
No Inverters Found
- Check USB connection
- Verify inverter is powered on
- Ensure USB drivers are installed
-
Metrics Not Updating
- Check inverter connectivity
- Verify polling interval settings
- Review application logs
-
Settings Not Available (503 Error)
- Settings are cached during metrics collection cycles
- Wait for next collection cycle (default: 30 seconds)
- Ensure metrics collection is enabled (
--axpert.metrics=true)
This project is licensed under the Apache 2.0 License - see the LICENSE file for details.

