A small Go service that reads a Growatt SPF 5000 ES inverter over Modbus and publishes its status and configuration to MQTT. It also provides Home Assistant MQTT discovery and accepts supported configuration commands through MQTT.
- Go 1.26.6 or newer
- A Growatt SPF 5000 ES connected through a serial/USB device
- An MQTT broker
- Linux with systemd, polkit,
usbreset, and thedialoutgroup for service installation
Copy the example configuration:
cp config.ini.example config.iniEdit config.ini and set at least:
MODBUS.PORTto the inverter's serial device, such as/dev/ttyUSB0MQTT.HOSTto the MQTT broker addressMQTT.USERandMQTT.PASSWORDif authentication is required
For a broker reached over an untrusted network, set MQTT.TLS_ENABLED = true.
The system trust store is used by default. MQTT.TLS_CA_FILE can add a private
CA; MQTT.TLS_CERT_FILE and MQTT.TLS_KEY_FILE configure mutual TLS, and
MQTT.TLS_SERVER_NAME overrides the certificate name when necessary.
Run the server from the repository directory:
go run .The server reads config.ini from its current working directory. Stop it with
Ctrl+C.
On the target Linux machine:
sudo ./systemd/install-systemd.sh
sudoedit /etc/spf5000es-server/config.ini
sudo systemctl enable --now spf5000es-server.serviceUseful commands:
systemctl status spf5000es-server.service
journalctl -u spf5000es-server.service -fThe installer leaves the service stopped so the configuration can be reviewed.
Pass --start to enable and start it immediately. To build locally and install
on another Linux machine over SSH:
./systemd/install-systemd.sh user@hostnameSee systemd/README.md for installation and removal details.
Topics use the configured MQTT.TOPIC_PREFIX (default:
growatt/spf5000es):
.../availabilityreportsonlineoroffline.../status/...contains inverter readings.../config/.../statecontains configuration values.../config/.../setaccepts supported configuration changes.../time_sync/setrequests an inverter clock sync
Home Assistant discovery messages use MQTT.HA_DISCOVERY_PREFIX, which defaults
to homeassistant.
Run the test suite:
go test ./...Build the binary:
go build -o spf5000es-server .This project is licensed under the terms in LICENSE.