Setting the time on a Growatt Inverter

After monitoring my solar inverter for over a year now, I have had a couple of instances where the daily energy graphs went a bit strange. It turns out that the inverter’s internal clock will occasionally drift by several hours.  This causes the daily energy production figure to reset at a time other than midnight.

Setting the time on the inverter is quite painful due to the “knock knock” user interface.  Thankfully, you can set the date and time by writing to ModBus registers.

I have created a script that now runs each morning to set the inverter’s date and time to the current date and time:

#!/usr/bin/env python
""" Created on Fri Sep 29 2016
@author: Paul Wilkinson
"""
from datetime import datetime
from pymodbus.client.sync import ModbusSerialClient as ModbusClient
# choose the serial client
client = ModbusClient(method='rtu', port='/dev/tx0000', baudrate=9600, stopbits=1, parity='N', bytesize=8, timeout=1)
 
client.connect()
 
now = datetime.now()
client.write_register(50,now.second)
client.write_register(45,now.year)
client.write_register(46,now.month)
client.write_register(47,now.day)
client.write_register(48,now.hour)
client.write_register(49,now.minute)
 
client.close()

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>