Read data from a Growatt inverter serial port and periodically write it to a CSV file.
Includes a logrotate example config to compress and rotate the results CSV. Also includes an example service file to run the script as a service.
- Python 3
- Logrotate (optional)
- Systemd (optional)
(Optional) Create a Python virtualenv and activate it:
python3 -m venv env source env/bin/activate
Install the Python requirements:
pip install -r requirements
Copy
growatt.logrotate.dist
togrowatt.logrotate
andgrowatt.service.dist
togrowatt.service
and adjust them to your Pi's setup. Note that the script usesargparse
to configure some settings. Run./read_growatt_inverter.py --help
to see a list of options to add to the service command:cp growatt.logrotate.dist growatt.logrotate cp growatt.service.dist growatt.service ./read_growatt_inverter.py --help
Copy
growatt.logrotate
to/etc/logrotate.d/growatt
:cp growatt.logrotate /etc/logrotate.d/growatt
Copy
growatt.service
to/etc/systemd/system/growatt.service
:cp growatt.service /etc/systemd/system/growatt.service
Enable the service:
systemctl enable --now growatt
- Tested (v1.0) on a Raspberry Pi 2B connected to a Growatt 3000 MTL-S inverter via serial (RS232) to USB cable.
- If you want proper logging: create
/var/log/growatt/growatt_reader.log
and it will write logging to it. - The script currently reads registers 0-45. According to the documentation there should be more than 45 registers, however during testing it appeared that I couldn't read more than the first 45 registers.