Skip to content

Commit

Permalink
Add install instructions and screenshots
Browse files Browse the repository at this point in the history
  • Loading branch information
infertux committed Jun 28, 2024
1 parent 6764702 commit d59da76
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 3 deletions.
71 changes: 69 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,83 @@
# growatt_exporter

growatt_exporter is a standalone program written in C that can query Growatt solar inverters (tested on SPF5000ES so far) and output metrics compatible with Prometheus.

growatt_exporter is a standalone program written in C that can query [Growatt](https://www.growattenergy.com/) 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](https://www.growattenergy.com/product/growatt-spf-5000-es-off-grid/) but should work with any product offering a RS485 interface.

## Screenshots

![PV Production](doc/pv-production.png)
![Inverter Output](doc/inverter-output.png)
![Home Assistant](doc/home-assistant.png)

The complete list of sensors can be found in [growatt.h](src/growatt.h).

## Build

### From source

```bash
apt install clang libbsd-dev libconfig-dev libmodbus-dev libmosquitto-dev mosquitto-clients
make
```

### Using Docker

```bash
./docker-build.sh
```

## Install

1. Install runtime dependencies:

`apt install libconfig9 libmodbus5 libmosquitto1`

2. Copy binary:

`cp growatt /opt/growatt-exporter`

3. 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"
}
```

4. Create systemd service file `/etc/systemd/system/growatt-exporter.service`:

```systemd
[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
```

5. Enable and start systemd service:

`systemctl enable --now growatt-exporter`

## Kudos

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.
Expand Down
1 change: 1 addition & 0 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
- BUGFIX: automatically reconnect to MQTT broker when connection lost
- add program option --verbose instead of compile-time LOG_VERBOSE define
- test program with either --mqtt XOR --prometheus but not both
- go through commented code
Expand Down
Binary file added doc/home-assistant.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/inverter-output.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/pv-production.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docker-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ channel="${1:-stable}" # can be overriden with "bullseye" for example
target=growatt
container=${target}-builder-${channel}
volume=/root/HOST
cc=clang-13
cc=clang

if [ -z "${FAST:-}" ]; then
docker pull "debian:${channel}"
Expand Down

0 comments on commit d59da76

Please sign in to comment.