SolarAssistant command-line tool
sacli is a command-line tool for reading live metrics from Solar Assistant sites. It handles authentication and connection details automatically, making it the easiest way to access the REST and WebSocket APIs.
Install sacli from the Solar Assistant CLI GitHub page.
Authentication
Cloud
To access sites via the SolarAssistant cloud, you need an API token. Generate one on your user details page, then configure sacli:
Local
To connect directly to a SolarAssistant device on your local network without a cloud account, save the device's IP address and password:
Metric snapshot - REST
Fetch the current value of all metrics from a site by name or ID:
Example output:
total/battery_power -5 W
total/pv_power 1240 W
total/load_power 940 W
inverter_1/device_mode Solar/Battery
Filter to specific topics using glob patterns:
sacli site my-site metrics -t "total/*"
Use --value to output only the value - useful in shell scripts:
echo "Load power is: $LOAD W"
Use --json for machine-readable NDJSON output:
{"topic":"total/load_power","group":"Status","name":"Load power","value":940,"unit":"W"}
{"topic":"total/battery_state_of_charge","group":"Status","name":"Battery state of charge","value":80,"unit":"%"}
Metric stream - WebSocket
Use --watch to stream live metrics continuously via WebSocket:
Filter to specific topics:
sacli site my-site metrics --watch -t "*"
Use --json for machine-readable output: