Multiple Growatt (SPH and MOD) solar inverters via modbus

Hi openHAB community.

I’ve spent several weeks to figure out how the best way to read data from my Growatt inverters and make them available to openHAB. Afterall I managed to find most of the interesting modbus registers and implemented many rules to control devices based on the amount of solar energy being generated (pool pump, water heaters etc.)

In case any of you are trying to achive the same I decided to post my findings/solutions here - maybe there are some among you finding this helpful or inspiring?

The setup:
Soft-/hardware:
openHAB 4.1.2 on raspberry pi 5b 8GB
modbus binding
solar forecast PV binding
influxDB
grafana
RS485 to serial/USB interface connected to USB port of openhab raspberry
1 x Growatt SPH10000TL3 BH-UP inverter
1 x Growatt ARK-HV 10.2kWh (9,21 usable) battery connected to SPH10000
1 x Growatt MOD3000TL3-XH BP inverter
1 X Growatt EV charger
1 X Eastron SDM630 smart meter connected to SPH10000 and EV charger (not connected to openHAB raspberry directly)

The look and feel on the UI:

On my energy management page the solar production is displayed by solar field:

Clicking the three dots on any of the solar field card brings a popup with some stats:

Clickin the card itself shows the history in production, battery state of charge, consumption etc. in form of a grafana graph:

Intro:
First I started with the grott MQTT solution but I’ve experienced issues such as data logger no longer visible in the Growatt App (Shine-App) and wrong readings of the 3-phase grid data consequently resulting in unclever decisions of the inverter as to what to do with the generated solar power and also, from time to time when I had to restart the openHAB server the grott service wouldn’t start automatically.

Bottom line I decided to switch from the MQTT (grott) solution to the modbus solution which I’m outlining in this post.

The modbus solutiuon:

The inverters only required minimum config/wiring:

  1. Frist I had to configure the SPH10000 to spit out its data on its RS485 port by setting the parameter RS485-settings->port to VPP and set the RS485-address of the SPH to 1.
  2. The MOD3000 only required setting its RS485-address (I chose 17).
  3. Then I connected the RS485-3 terminal of the SPH to the raspberry and the Growatt MOD3000 inverter (bus topology: raspberry being first device, then SPH last MOD).
    Even though I have a approx. 20m (60ft) cable between first and last modbus device I did not need to use terminal resistors on the RS484 line.

The openHAB config was way more complex:
Since some values are being sent in two separate but subsequent modbus registers (each being a uint16, one being the HI- the other the LO-value) I used a trick by reading both registers at once via a uint32 thing and send the value into a JS transformation (growattUint32To2xUint16.js) to “extract” the correct value.

JS-Transformation “growattUint32To2xUint16.js” to extract value of a uint32 modbus register:

(function(val) {
    if(val < 0) return "UNDEF";
    lo = val & 0xffff;          // first 16 bits
    hi = (val >> 16) & 0xffff;  // last 16 bits
    return ( (lo / 10) + (hi / 10 * 65536) )
  })(input)

Thing file for SPH Inverter:
Modbus_growattSPH.things.txt (17.8 KB)

Thing file for MOD Inverter:
Modbus_growattMOD.things.txt (10.9 KB)

SPH Items file:
Growatt_SPH.items.txt (41.5 KB)

MOD items file:
Growatt_MOD.items.txt (21.9 KB)

Items representing data on an aggregate of both invereters I put in a third Items file:
Growatt.items.txt (1.2 KB)

Rules to calculate some Items values such as degree of self-sufficiency (Autarkie) or max daily/overall production values etc:
Growatt.rules.txt (17.8 KB)

As to the animated energy-flow widget I adopted and modified the widget described here:
animated energy widget

My version of the animated energy flow widget:
energy_widget.txt (22.7 KB)

Open issues:

  • still didn’t figure out how to best read out the values from the smart meter directly via the same single RS485 bus which currently connects to SPH, the MOD and the raspberry.
  • Voltage values for 3 grid phases still show ±400V each - probably an issue with proper smart meter readings by the SPH
  • clean-up of items and thing files (remove unnecessary stuff)
  • some overall values (combined SPH and MOD measurements) appear off (such as degree of self-suffiency/Autarkie)
  • daily production values in grafana graph missing (I want one bar chart with bars for each of the four solar-strings)
  • Im sure there are several more :wink:

Maybe some of you find this helpful!?
Have fun!

Kind regards,
Ralph…

There is a Growatt binding in OH v4.2 …

Hi AndrewFG.

Interesting - I did see the development requests for such binding and good we’ll have a Growatt binding soon!

Unfortunately the binding apparently still relies on the grott service with which I made some unsatisfying experience (it probably still depends on grott to correctly and completely map the values received from the various inverters to its output).
I’ll take a look at it as soon as it becomes available as part of the stable release and will probably post my findings here.

An additional idea for improving the binding that comes to my mind is an option to use modbus as an alternative to the grott service as a communication medium with the inverters :wink:

Thanks and kind regrads,
Ralph…

TBH we have had it for over 6 months already.

Yes it does use the Grott proxy service, which happily runs on the same RPi machine.

It has been explicitly validated with user inputs for SPH and MID inverters with resp. GBLI and APX batteries plus a CHNT meter. I have not had feedback from any user with a MOD inverter yet, but obviously if there is anything missing for that model, I can fix it for you.

I’ll check it out with my SPH and MOD inverters and will provide feedback here ASAP…