growatt_exporter is a standalone program written in C that can query Growatt solar inverters and output metrics compatible with Prometheus, Grafana, MQTT and Home Assistant. This allows to monitor PV production, battery status, etc. on a nice Grafana interface.
This has been tested extensively on the SPF 5000 ES but should work with any product offering a RS485 interface.
The complete list of sensors can be found in growatt.h.
apt install clang libbsd-dev libconfig-dev libmodbus-dev libmosquitto-dev mosquitto-clients
make
./docker-build.sh
- Install runtime dependencies:
apt install libconfig9 libmodbus5 libmosquitto1
- Copy binary:
cp growatt_exporter /opt/growatt-exporter
- Create config file
/etc/growatt-exporter.conf
:
device_or_uri = "/dev/ttyUSB0"
prometheus = {
port = 1234
}
mqtt = {
host = "10.0.0.1"
port = 1883
username = "homeassistant"
password = "foobar"
}
- Create systemd service file
/etc/systemd/system/growatt-exporter.service
:
[Unit]
After=network.target
[Service]
ExecStart=/opt/growatt-exporter /etc/growatt-exporter.conf
Restart=on-failure
RestartSec=10
PrivateTmp=true
ProtectHome=true
ProtectProc=invisible
ProtectSystem=full
[Install]
WantedBy=multi-user.target
- Enable and start systemd service:
systemctl enable --now growatt-exporter
The "Growatt OffGrid SPF5000 Modbus RS485 RTU Protocol" PDF document has been a very valuable resource. A copy of it is included in this Git repository. Thank you to the original author for their work.
Would like to monitor Epever/Epsolar Tracer solar charge controllers instead? Here is a sister repository for that: https://github.com/infertux/epever_exporter
- Blog post: https://www.splitbrain.org/blog/2023-11/03-growatt_and_home_assistant
- Reading Modbus registers via Home Assistant: home-assistant/core#94149
- https://github.com/rspring/Esphome-Growatt
AGPLv3+