Binding request: Growatt Server

Hi,

Is someone willing and skilled enough to develop a binding that logs in to server.growatt.com and retrieves data on solar panels?

Here’s some documents for the API:
http://growatt.pl/wp-content/uploads/2020/01/Growatt-Server-API-Guide.pdf

And maybe this is helpfull?

Thanks.

If somebody want a particular binding it is recommended they post a bounty using bounty-source if they are unable to develop it themselves.
This is to encourage one of the volunteer developers to work on it.

Of course, but i thought i’d give it a shot in here first.

I’m using https://github.com/johanmeijer/grott/wiki/Rerouting-Growatt-Wifi-TCPIP-data-via-a-Linux-Server

I’ve seen that solution but it requires a dedicated Pi. Something i don’t want.
I’ve been playing with Home Assitant which has this little intergration for Growatt that made me think it would be possible to make a binding.

The Grott growatt monitor program ( https://github.com/johanmeijer/grott) does not require a seperate RPI. It can run at any linux system.

The latest version has a proxy mode that can be used without IP forwarding.

I run it on a system together with my home automation, mqtt, node red, influx db and grafana.

I’ve got the script running but not getting any data through mqtt. Probably because i have a ShineLanBox with a RF datalogger instead of the ShineWIFI-S wifi device.

Hi Nils, shine lan should work. I know there is at least one person is using it…

I believe the shine lan does not use encryption (and other record specs). Maybe you can test it with decrypt = False and/or compat = False.

See also:

If this not works than I have to look at the output.

Stupid question but did you rerouted the data via the device Grott is running?

I think i’ve tried all possible options regarding decrypt = False and/or compat = False. But still not getting any mqtt data.
I only set net.ipv4.ip_forward to 1 in /etc/sysctl.conf.

#Specify grott monitor configuration

[Generic]

Specify inverter id

inverterid = 5FZI909093

Specify mode (sniff or proxy)

mode = proxy

specify port to listen to (only proxy, default 5279)

port = 5279
#Decrypt is False if growatt communication is not encrypted (older inverters)
decrypt = False
#Compat is True and valoffset needs to be set if offset / growatt protocol has been changed. Since 2020 this needs to be specified (True,26)
compat = False
valueoffset = 26

[Growatt]
#ip address and port of Growatt server
ip = 47.91.67.66
port = 5279

[MQTT]
#mqtt parameters definitions
ip = 192.168.2.3
port = 1883
topic= energy/growatt
auth = False
user = …
password = …

LOG:
May 24 09:57:14 openhab systemd[1]: Started Grott Growatt monitor.
May 24 09:57:14 openhab grott[1589]: Grott Growatt logging monitor : 2.0.1
May 24 09:57:14 openhab grott[1589]: Grott Command line parameters processed:
May 24 09:57:14 openhab grott[1589]: verbose: True
May 24 09:57:14 openhab grott[1589]: config file: grott.ini
May 24 09:57:14 openhab grott[1589]: output file: <_io.TextIOWrapper name=’’ mode=‘w’ encoding=‘UTF-8’>
May 24 09:57:14 openhab grott[1589]: nomqtt: False
May 24 09:57:14 openhab grott[1589]: trace: False
May 24 09:57:14 openhab grott[1589]: Grott settings:
May 24 09:57:14 openhab grott[1589]: _Generic:
May 24 09:57:14 openhab grott[1589]: version: 2.0.1
May 24 09:57:14 openhab grott[1589]: verbose: True
May 24 09:57:14 openhab grott[1589]: trace: False
May 24 09:57:14 openhab grott[1589]: config file: grott.ini
May 24 09:57:14 openhab grott[1589]: minrecl: 100
May 24 09:57:14 openhab grott[1589]: decrypt: False
May 24 09:57:14 openhab grott[1589]: compat: False
May 24 09:57:14 openhab grott[1589]: valueoffset: 26
May 24 09:57:14 openhab grott[1589]: offset: 6
May 24 09:57:14 openhab grott[1589]: inverterid: 5FZI909093
May 24 09:57:14 openhab grott[1589]: mode: proxy
May 24 09:57:14 openhab grott[1589]: grottport 5279
May 24 09:57:14 openhab grott[1589]: _MQTT:
May 24 09:57:14 openhab grott[1589]: nomqtt False
May 24 09:57:14 openhab grott[1589]: mqttip: 192.168.2.3
May 24 09:57:14 openhab grott[1589]: mqttport: 1883
May 24 09:57:14 openhab grott[1589]: mqtttopic: energy/growatt
May 24 09:57:14 openhab grott[1589]: mqtttauth: False
May 24 09:57:14 openhab grott[1589]: mqttuser:
May 24 09:57:14 openhab grott[1589]: mqttpsw:
May 24 09:57:14 openhab grott[1589]: _Growatt server:
May 24 09:57:14 openhab grott[1589]: growattip: 47.91.67.66
May 24 09:57:14 openhab grott[1589]: growattport: 5279
May 24 09:57:14 openhab grott[1589]: Grott proxy mode started

And then nothing…

Hi Nils. This looking oke but it did expect that data that was send from the inverter to the growatt server had been shown as well.

Did you configured your lan stick to send the data to server where grott is running? That is also needed for the proxy mode. Grott will then send the data to Growatt.

This can be done in eiher the setup dialog of the lan stick or via the Growatt website.

It is second part of what is described in the wiki in the IP-Forwarding description.
You can ignore the ip forwarding setup.

The growatt website has been changed so the screens look different. I will update the wiki for this.

I do understand that it is not totally clear that also in proxy mode you need to send the growatt data via the server grott is running. I will describe that as well.

1 Like

Thanks Johan, got it working now.

And for the grott.ini file i had to use :
decrypt = True
compat = False

My inverter is a Growatt - 4200MTL-S.

1 Like

Hello Johan,
I installed Grott on my RPI3B and I can confirm it works very well with OpenHAB2.5. As a bonus also pvoutput is updated.Thank you for the excellent work!
If you are interested I can share my OpenHAB config for your wiki.
Regards, Ton

1 Like

Hi Ton,

Thank you for your feedback. Always nice to hear it is running well :slight_smile:

Yes please share your OpenHAB config. It will be a good addition to the wiki.

Regards,
Johan

Hello Johan,

Please find below the way I installed Grott and present the PV information with OpenHAB and pvoutput. I have a RPI 3B, running OpenHAB 2.5. I am using the textual configuration for OpenHAB.

I installed your Grott on the RPI in the proxy mode. The scripts I placed in directory /etc/openhab2/scripts/grott. I also created an account for pvoutput.org. This is all documented in your Wiki (first time installation).

With openhabian-config I installed MQTT mosquitto on the RPI. I added Mqtt to addons.cfg. In the PV installation I changed the server address to the ip adress of my RPI, according to the instructions in your wiki.

The OpenHAB configuration files are adopted in the following way.

Things:

Bridge mqtt:broker:bbp295broker "BBP295 MQTT Broker"[ host="192.168.1.1", port=1883, secure=false]
{
    Thing topic pvbbp295info "PV BBP295 informatie"
	{
        Channels:

            Type number : ch_pvpowerout "PV produktie" [ stateTopic="bbp295/growatt", transformationPattern="JSONPATH:$.values.pvpowerout" ]	
            Type number : ch_pvenergytoday "PV produktie vandaag" [ stateTopic="bbp295/growatt", transformationPattern="JSONPATH:$.values.pvenergytoday" ]
            Type number : ch_pvenergytotal "PV produktie totaal" [ stateTopic="bbp295/growatt", transformationPattern="JSONPATH:$.values.pvenergytotal" ]	
            Type number : ch_pvstatus "PV status" [ stateTopic="bbp295/growatt", transformationPattern="JSONPATH:$.values.pvstatus" ]	
            Type datetime : ch_time "PV laatste bericht" [ stateTopic="bbp295/growatt", transformationPattern="JSONPATH:$.time" ]				
    }
}

Items:

Number		mqtt_pvpowerout			"PV produktie MQTT"  								   					   {channel="mqtt:topic:bbp295broker:pvbbp295info:ch_pvpowerout"}
Number		pv_pvpowerout			"PV produktie [%.3f kW]" 							   <energy> (P1_Chart)
Number		mqtt_pvenergytoday		"PV produktie vandaag MQTT"	 						   					   {channel="mqtt:topic:bbp295broker:pvbbp295info:ch_pvenergytoday"}
Number		pv_pvenergytoday		"PV produktie vandaag [%.3f kWh]"	 				   <energy>	
Number      pv_pvenergytoday_Euro   "PV opbrengst vandaag [%.2f Euro]"				       <energy> 
Number		mqtt_pvenergytotal		"PV produktie totaal MQTT"				  		       <energy>			   {channel="mqtt:topic:bbp295broker:pvbbp295info:ch_pvenergytotal"}
Number		pv_pvenergytotal		"PV produktie totaal [%.1f kWh]"		  		       <energy>	
Number      pv_pvenergytotal_Euro   "PV opbrengst totaal [%.2f Euro]"					   <energy> 
Number		pv_pvstatus				"PV status"         				  				   <energy> 	       {channel="mqtt:topic:bbp295broker:pvbbp295info:ch_pvstatus"}
DateTime 	pv_time					"PV laatste bericht [%1$td-%1$tm-%1$tY %1$tH:%1$tM]"   <clock> 	           {channel="mqtt:topic:bbp295broker:pvbbp295info:ch_time"}

Rule (To correct and present the output from your script).

rule "Update pv values"
when
	Item pv_time changed
then

	// Corrigeren mqtt waarden
	val Number mqttpowerout = mqtt_pvpowerout.state as DecimalType
	pv_pvpowerout.postUpdate(mqttpowerout / 10000)
	val Number mqttenergytoday = mqtt_pvenergytoday.state as DecimalType	
	pv_pvenergytoday.postUpdate(mqttenergytoday / 10)
	val Number mqttenergytotal = mqtt_pvenergytotal.state as DecimalType		
	pv_pvenergytotal.postUpdate(mqttenergytotal / 10)

	// Bedragen uitrekenen
	val Number pvenergytoday = pv_pvenergytoday.state as DecimalType
	pv_pvenergytoday_Euro.postUpdate(pvenergytoday * 0.19096)
	val Number pvenergytotal = pv_pvenergytotal.state as DecimalType
	pv_pvenergytotal_Euro.postUpdate(pvenergytotal * 0.19096)

end

Sitemap:

	Text item=pv_pvpowerout valuecolor=["blue"]
	{
		Frame  label="Produktie zonnepanelen" 
		{
			Text item=pv_pvpowerout valuecolor=["blue"]
			Text item=pv_pvenergytoday
			Text item=pv_pvenergytoday_Euro				
			Text item=pv_pvenergytotal			
			Text item=pv_pvenergytotal_Euro	
		}
		Frame  label="Status zonnepanelen" 			
		{
			Switch item=pv_pvstatus mappings=[0=Waiting, 1=Normal, 2=Fault]				
			Text item=pv_time				
		}
       }

This should do the trick. Please let me know if you have enough information.

1 Like

Hi Johan,

I am trying to use the Grott SW for the 6000TL3-S inverter which has a different data format as it is a 3-phase device.
Do you have information on the data format used by Growatt for their 3-phase inverters?
This would allow me to modify your SW to work properly with my inverter.

Regards,
–Simon

Yes, I have the information available. Somebody else already build it and sent me the changes.
I had planned it for a next release to build it in.

For me it is a little bit more work because I have to investigate, build and test for all types of records (at this moment there are 5 different record layouts).

Do you have Grott running already? If you have and you can sent me your data (layout type and growatt original data). I can send you the needed changes or if you like I can build it in directly (would have done this anyhow in the comming weeks).

Hi Johan,

I figured out myself how the info is constructed and can read the data for all 3 phases. I can share that with you.
One other question.
I observed that Grott receives two records. One has encrypted and the other has plain data.
I can see that the raw data of one package is identical (except for the last 4 bytes) to the decryoted data of the other record,
Grott still decrypts the the unencrypted record with the result that the data itself is now rubbish. Is there any additional check possible to verify if the record is encrypted or plain, as the current implementation doesn’t seem to verify this properly.

–Simon

    self.recorddict2 = {"T05NNNN": {
        "decrypt"           : "True",
        "pvserial"          : 36,
        "date"              : 56,
        "pvstatus"          : 78,
        "pvpowerin"         : 82,
        "pv1voltage"        : 90,
        "pv1current"        : 94,
        "pv1watt"           : 98,
        "pv2voltage"        : 106,
        "pv2current"        : 110,
        "pv2watt"           : 114,
        "pvpowerout"        : 122,
        "pvfrequentie"      : 130,
        "pvrvoltage"        : 134,
        "pvrcurrent"        : 138,
        "pvrwatt"           : 142,
        "pvsvoltage"        : 150,
        "pvscurrent"        : 154,
        "pvswatt"           : 158,
        "pvtvoltage"        : 166,
        "pvtcurrent"        : 170,
        "pvtwatt"           : 174,
        "pvenergytoday"     : 182,
        "pvenergytotal"     : 190,
        "pvtemperature"     : 206,
        "pvipmtemperature"  : 242,
        } }

I am not aware Grott is receiving 2 data records (haven’t seen it before).

It either unecrypted (T02NNNN) or encrytpted (T05NNNN or T06NNNN).

At start up there is a announce record that looks alomst the same: T0x0103. But I think that is encypted to.

I am very interested in the types of records you see.

Johan,

Hereby an exemple.

–Simon

    - Growatt packet received:
              <socket.socket fd=4, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('192.168.178.97', 53790), raddr=('47.91.67.66', 5279)>
     - Growatt original Data:
             \x00\xa6\x00\x05\x00\xd9\x51\x04\x09\x33\x2c\x44\x58\x45\x46\x77\x4b\x2b\x3f
             \x23\x30\x47\x7e\x41\x5e\x47\x53\x44\x74\x47\x72\x6f\x77\x61\x76\x74\x47\x72
             \x43\x77\x60\x74\x74\x48\x2a\x60\x0f\x61\x71\x74\x47\x75\xd3\x78\x58\x74\x71
             \x47\x72\x68\xeb\x61\x74\x79\x39\x61\xe6\x78\xc6\x74\x73\x47\x72\x69\x27\x6e
             \xd4\x74\x40\x72\x6f\x71\x2c\x7b\xe2\x47\x75\x6f\x77\x67\x3d\x74\x47\x72\x45
             \x77\x60\x5e\xd2\x46\x98\x71\x67\x60\x74\x74\x47\x72\x6f\x77\x61\x74\x74\x47
             \x72\x6f\x77\x61\x74\x74\x47\x73\x58\x7c\xc9\x7f\xdc\x47\x72\x6f\x5a\x61\x2d
             \x3a\x67\x72\x6f\x77\x61\x74\x74\x47\x65\x6f\x77\xc5\x99\x74\x47\x72\x78\x77
             \x61\xd7\x53\x47\x73\x27\x63\x61\x74\x74\x47\x72\x6f\x77\x61\x74\x74\x47\x72
             \x6f\x77\x61\x74\x74\x41\x72\x6f\x9d\x01\x74\x74\x47\x72\x6f\x77\x61\x74\x74
             \x47\x72\x6f\x77\x61\x74\x74\x47\x72\x6f\x77\x61\x74\x74\x47\x72\x6f\x77\x61
             \x74\x74\x47\x72\x6f\x77\x61\x74\x74\x47\x72\x6f\x77\x61\xff\x58
     - Grott automatic protocol detection
     - Grott data record length 225
     - layout   :  T055104
     - Record layout used :  T05NNNN
     - decrypt :  True
     - Growatt data decrypted V2
     - Growatt plain data:
             00a6000500d951044e41433339313230394448424433393331303230000000000000020000002
             c000100000f580f780005000007bc0f3900050000079c00000d7e13890fa70007000006500fa0
             00070000064d0f960007000006490000002a00012aa601ea1e100100000000000000000000000
             0000000000001370ba80ba80000002d00594e2000000000000000170000a4ed000000170000a3
             27000148140000000000000000000000000000000000060000ea6000000000000000000000000
             00000000000000000000000000000000000000000000000000000000000008b2c
     - Growatt new layout processing
             - decrypt       :  True
             - offset        :  6
             - record layout :  T05NNNN

     - Grott data record date/time processing started
     - no or no valid time/date found, grott server time will be used (buffer records not sent!)
     - Grott values retrieved:
             - pvserial:          HBD3931020
             - pvstatus:          1
             - pvpowerin:         392.8
             - pvpowerout:        345.4
             - pvenergytoday:     4.2
             - pvenergytotal:     7645.4
             - pv1voltage:        396.0
             - pv1current:        0.5
             - pv1watt:           198.0
             - pv2voltage:        389.7
             - pv2current:        0.5
             - pv2watt:           194.8
             - pvfrequentie:      50.01
             - pvrvoltage:        400.7
             - pvrcurrent:        0.7
             - pvrwatt:           161.6
             - pvsvoltage:        400.0
             - pvscurrent:        0.7
             - pvswatt:           161.3
             - pvtvoltage:        399.0
             - pvtcurrent:        0.7
             - pvtwatt:           160.9
             - pvtemperature:     25.6
             - pvipmtemperature:  31.1
     - MQTT jsonmsg:
                     {"device": "HBD3931020", "time": "2021-01-23T13:53:04", "buffered": "no",
                     "values": {"pvstatus": 1, "pv1watt": 1980, "pv2watt": 1948, "pvpowerin":
                     3928, "pvpowerout": 3454, "pvfrequentie": 5001, "pvrvoltage": 4007,
                     "pvrcurrent": 7, "pvrwatt": 1616, "pvsvoltage": 4000, "pvscurrent": 7,
                     "pvswatt": 1613, "pvtvoltage": 3990, "pvtcurrent": 7, "pvtwatt": 1609,
                     "pvenergytoday": 42, "pvenergytotal": 76454, "pv1voltage": 3960,
                     "pv2voltage": 3897, "pv1current": 5, "pv2current": 5, "pvtemperature": 256,
                     "pvipmtemperature": 311}}
     - MQTT connection refused by target
     - Grott Send data to PVOutput disabled
     - Grott Send data to Influx disabled
     - Grott extension processing disabled

     - Growatt packet received:
              <socket.socket fd=4, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('192.168.178.97', 53790), raddr=('47.91.67.66', 5279)>
     - Growatt original Data:
             \x00\xa7\x00\x05\x00\xd9\x51\x04\x4e\x41\x43\x33\x39\x31\x32\x30\x39\x44\x48
             \x42\x44\x33\x39\x33\x31\x30\x32\x30\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00
             \x2c\x00\x01\x00\x00\x0f\x58\x0f\x78\x00\x05\x00\x00\x07\xbc\x0f\x39\x00\x05
             \x00\x00\x07\x9c\x00\x00\x0d\x7e\x13\x89\x0f\xa7\x00\x07\x00\x00\x06\x50\x0f
             \xa0\x00\x07\x00\x00\x06\x4d\x0f\x96\x00\x07\x00\x00\x06\x49\x00\x00\x00\x2a
             \x00\x01\x2a\xa6\x01\xea\x1e\x10\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
             \x00\x00\x00\x00\x00\x00\x00\x01\x37\x0b\xa8\x0b\xa8\x00\x00\x00\x2d\x00\x59
             \x4e\x20\x00\x00\x00\x00\x00\x00\x00\x17\x00\x00\xa4\xed\x00\x00\x00\x17\x00
             \x00\xa3\x27\x00\x01\x48\x14\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
             \x00\x00\x00\x00\x00\x06\x00\x00\xea\x60\x00\x00\x00\x00\x00\x00\x00\x00\x00
             \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
             \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1e\x10
     - Grott automatic protocol detection
     - Grott data record length 225
     - layout   :  T055104
     - Record layout used :  T05NNNN
     - decrypt :  True
     - Growatt data decrypted V2
     - Growatt plain data:
             00a7000500d9510409332c44584546774b2b3f2330477e415e4753447447726f7761767447724
             377607474482a600f6171744775d378587471477268eb6174793961e678c67473477269276ed4
             7440726f712c7be247756f77673d7447724577605ed24698716760747447726f7761747447726
             f776174744773587cc97fdc47726f5a612d3a67726f7761747447656f77c599744772787761d7
             534773276361747447726f7761747447726f7761747441726f9d01747447726f7761747447726
             f7761747447726f7761747447726f7761747447726f7761747447726f77616a64
     - Growatt new layout processing
             - decrypt       :  True
             - offset        :  6
             - record layout :  T05NNNN

     - Grott data record date/time processing started
     - no or no valid time/date found, grott server time will be used (buffer records not sent!)
     - Grott values retrieved:
             - pvserial:          ?#0G~A^GSD
             - pvstatus:          30560
             - pvpowerin:         195377770.6
             - pvpowerout:        163502316.1
             - pvenergytoday:     195083936.5
             - pvenergytotal:     200280443.4
             - pv1voltage:        2459.1
             - pv1current:        2494.5
             - pv1watt:           195084027.5
             - pv2voltage:        3080.8
             - pv2current:        2980.9
             - pv2watt:           119868029.9
             - pvfrequentie:      250.62
             - pvrvoltage:        3091.8
             - pvrcurrent:        2981.1
             - pvrwatt:           119868035.9
             - pvsvoltage:        2837.2
             - pvscurrent:        2976.0
             - pvswatt:           191990609.2
             - pvtvoltage:        3171.4
             - pvtcurrent:        1829.3
             - pvtwatt:           187009618.9
             - pvtemperature:     2469.2
             - pvipmtemperature:  2952.8
     - MQTT jsonmsg:
                     {"device": "?#0G~A^GSD", "time": "2021-01-23T13:53:21", "buffered": "no",
                     "values": {"pvstatus": 30560, "pv1watt": 1950840275, "pv2watt": 1198680299,
                     "pvpowerin": 1953777706, "pvpowerout": 1635023161, "pvfrequentie": 25062,
                     "pvrvoltage": 30918, "pvrcurrent": 29811, "pvrwatt": 1198680359,
                     "pvsvoltage": 28372, "pvscurrent": 29760, "pvswatt": 1919906092,
                     "pvtvoltage": 31714, "pvtcurrent": 18293, "pvtwatt": 1870096189,
                     "pvenergytoday": 1950839365, "pvenergytotal": 2002804434, "pv1voltage":
                     24591, "pv2voltage": 30808, "pv1current": 24945, "pv2current": 29809,
                     "pvtemperature": 24692, "pvipmtemperature": 29528}}
     - MQTT send failed: Connection Refused: not authorised.
     - Grott Send data to PVOutput disabled
     - Grott Send data to Influx disabled
     - Grott extension processing disabled