A Go application that connects to LiTime MPPT Solar Charge Controllers via Bluetooth Low Energy (BLE) to collect real-time metrics and send them to InfluxDB for monitoring and analysis.
This application monitors solar charge controller data from LiTime MPPT controllers by establishing a Bluetooth connection and continuously collecting metrics such as:
- Battery voltage, current, and power
- Controller temperature
- Load voltage, current, status (on/off) and power
- Solar panel voltage
- Daily energy statistics
- Total energy and running days
The collected data is automatically sent to an InfluxDB instance for storage, enabling you to create dashboards and monitor your solar power system's performance over time.
- Real-time data collection via Bluetooth Low Energy
- Automatic InfluxDB integration
- Configurable via command line arguments, environment variables, or YAML config file
- Robust error handling for Bluetooth communication
- Periodic logging of collected metrics
Make sure you have Go installed, then build the application:
go build -o litime-monitor
./litime-monitor [flags]
Flag | Default | Description |
---|---|---|
--influxdb.url |
http://127.0.0.1:8086 |
InfluxDB server URL |
--influxdb.token |
my-token |
InfluxDB authentication token |
--influxdb.org |
my-org |
InfluxDB organization name |
--influxdb.bucket |
solar_charge_controller |
InfluxDB bucket name for data storage |
--device.address |
00:00:00:00:00:00 |
Bluetooth MAC address of your LiTime controller |
--device.service |
0000ffe0-0000-1000-8000-00805f9b34fb |
Bluetooth service UUID |
--device.characteristic |
0000ffe1-0000-1000-8000-00805f9b34fb |
Bluetooth characteristic UUID |
-h, --help |
Show help information |
The application supports multiple configuration methods (in order of precedence):
- Command line flags (highest priority)
- Environment variables with
LITIME_MONITOR_
prefix - Configuration files in YAML format
Prefix all configuration keys with LITIME_MONITOR_
and use uppercase:
export LITIME_MONITOR_INFLUXDB_URL="http://your-influxdb:8086"
export LITIME_MONITOR_INFLUXDB_TOKEN="your-token"
export LITIME_MONITOR_DEVICE_ADDRESS="AA:BB:CC:DD:EE:FF"
Create a config.yaml
file in one of these locations:
/etc/litime-monitor/config.yaml
$HOME/.litime-monitor/config.yaml
./config.yaml
(current directory)
Example configuration:
influxdb:
url: "http://your-influxdb:8086"
token: "your-influxdb-token"
org: "your-org"
bucket: "solar_data"
device:
address: "AA:BB:CC:DD:EE:FF"
service: "0000ffe0-0000-1000-8000-00805f9b34fb"
characteristic: "0000ffe1-0000-1000-8000-00805f9b34fb"
- Find your LiTime controller's Bluetooth address: Use your system's Bluetooth settings or a BLE scanner app to identify your devices bluetooth address
- Set up InfluxDB: Ensure you have an InfluxDB instance running and create a bucket for the data
- Configure the application: Set the device address and InfluxDB connection details
- Run the application: The monitor will automatically connect and start collecting data
Data is stored in InfluxDB with the measurement name solar_charge_controller
and the following fields:
battery_voltage
(float)battery_current
(float)battery_power
(int)controller_temperature
(float)load_voltage
(float)load_current
(float)load_power
(float)load_status
(string)panel_voltage
(float)max_charge_power
(int)energy_today
(int)running_days
(int)total_energy
(int)
Contributions are welcome! I'm particularly interested in:
- Additional data sinks: Support for other time-series databases (Prometheus, TimescaleDB, etc.)
- Improved response data handling: Better parsing and validation of controller responses
- Additional device support: Compatibility with other MPPT controller brands
Please feel free to open issues or submit pull requests.
- Fix energy total overflow
- Add Load Status (on/off) capture
- Initial release
- Bluetooth Low Energy connectivity for LiTime MPPT controllers
- InfluxDB data sink integration
- Configurable via CLI args, environment variables, and YAML files
- Real-time monitoring of battery, load, and solar panel metrics
- Robust error handling and logging
This project is open source. Please check the license file for details.