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:
- 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.
- The MOD3000 only required setting its RS485-address (I chose 17).
- 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
Maybe some of you find this helpful!?
Have fun!
Kind regards,
Ralph…