Anyone experience with connecting a Growatt solar-inverter?

@indykoning I have a OneSolar inverter. The OneSolar wifi dongle seems to be a rebadged Growatt wifi dongle. Instead of connecting to the Growatt server, the dongle connects to the SMTEN server. Other than that, everything else seems to be exactly the same.

Using https://github.com/indykoning/PyPi_GrowattServer, I was able to connect to the SMTEN server and got some data back.

import growattServer

api = growattServer.GrowattApi()
api.server_url = 'http://server.smten.com/'
login_response = api.login(<username>, <password>)
#Get a list of growatt plants.
print(api.plant_list(login_response['userId']))

As you can see above, I used the api.server_url variable to point to the the SMTEN server instead of the default Growatt server.

Would it be possible to add server_url as an optional configuration item to the HomeAssistant Growatt component? That way, I would be able to get my invertor talking to HA.

Thanks!

This is not built in on the integration yet, but it is easy to install this as a custom component and add a small change to it.

On this line https://github.com/home-assistant/core/blob/cd054a9579b3025ff37b83527e87f8dca960d54c/homeassistant/components/growatt_server/sensor.py#L126
you want to add api.server_url = 'http://server.smten.com/'
assuming the same app with the same endpoints are being used this should get the integration working.

1 Like

Hi @pobl
I tried using this, it works on the total sensors but inverter sensors appears to be not linked, hence all values shows as 0.
Have I missed anything?

Is it possible to get the battery state of charge?

I am currently working on displaying these values nicely in Home Assistant.
I have not had any success with the Growatt integration - it did not give me the values I wanted.

So I ended up writing a small Python script that scrapes the site and sends the values to Home Assistant…

This is from the Growatt website:

and this is what is displayed in Home Assistant:
Screen Shot 2020-07-15 at 1.54.24 pm

1 Like

I have added the Growatt sensor and it extracting the correct values during the day, it is not using timezone correctly. I am in GMT + 10, and it seems to reset the Growatt Total Energy Today and the same for the inverter at around 8pm, how or where do I set the timezone correctly?

Last friday I got solar pannels with a growatt inverter (GroWatt MIN 5000TL-XE) and offcourse a wifi stick. Added it directly to HA. I only have to general sensors and not the specific inverter sensors. Can someone help me to get the inverter sensors?

I use a custom component, not the official intergration, for exactly that reason. Github: https://github.com/indykoning/home-assistant-growatt-server

If I use that custom component the sensor for the inverter is created, but all values stay at 0.

@indykoning Can you help me to get the values from the inverter with your custom component?

Hi @indykoning
I’m so sorry but i’m very new in that software and applications, so I can’t add growatt storage on my Home assistant.

Could you explain how can I integrate your precious py code to home assistant?
Till now I can take values only from inverter but I miss battery soc and load consumption
Thanks a lot.

Hi @Danros3 and @spock85,
Actually the custom component is outdated when compared to the one in Home Assistant now. The custom component is the version as it is in Home Assistant 0.99.

After this compatibility for seperate storage devices have been added (i dont remember a specific version but 0.110+ should be fine).

I will update the custom component with what i have running locally for me (getting temperatures from the inverters themselves) which i will try merging into home assistant once i have the time.

If you’re getting empty values and know a slight bit of python, try messing with the example in https://github.com/indykoning/PyPi_GrowattServer
You can download a zip and run the whole thing or only download the example and install GrowattServer using pip. See if you can find a way to show the data there.

I have now updated the custom component


If you do not want the updated version, you can always go back in time with the commits:

Hi @spock85, about the built-in integration not working:
Would you be able to pull https://github.com/indykoning/PyPi_GrowattServer/ on your computer (or install the package using pip install growattServer)

Then paste

import growattServer
api = growattServer.GrowattApi()
login_response = api.login('<username>', '<password>')
#Get a list of growatt plants.
plants = api.plant_list(login_response['userId'])
deviceList = api.device_list(plants['data'][0]['plantId'])

print(deviceList)

into the example.py or a new .py file, change the credentials and run it using python example.py
Then send me the output of it (feel free to remove the Sn and deviceAlias)
It should hopefully look something like this

[
    {   
        'datalogSn': '',
        'deviceAilas': '',
        'deviceSn': '',
        'deviceStatus': 2,
        'deviceType': 'inverter',
        'eToday': '8.6',
        'eTodayStr': '8.6kWh',
        'energy': '2277',
        'invType': '0',
        'location': '',
        'lost': False,
        'power': '17.6',
        'powerStr': '0.02kW'
    }
]

My guess is that the “DeviceType” is returning something different than inverter.
The integration currently only supports ‘inverter’ and ‘storage’ but maybe the name is slightly different while it would work perfectly normal if only recognised as an inverter.

I think i had this issue as well with one of my inverters, you have to set the timezone and time correctly in the inverter itself.

Hi, The build-in integration gives me only totals, not the inverter specific sensors.
This is the output, I removed SN.

[{
	'lost': False,
	'location': '',
	'eToday': '37.5',
	'datalogSn': 'XXX0000000',
	'deviceSn': 'YYY1111111',
	'deviceStatus': 1,
	'type': 0,
	'powerStr': '0.05kW',
	'bdc1Soc': 0,
	'eTodayStr': '37.5kWh',
	'deviceAilas': 'YYY1111111',
	'deviceType': 'tlx',
	'bdc2Soc': 0,
	'type2': 1,
	'power': '45.7',
	'energy': '195.8'
}]

That’s interesting, never seen a “tlx” devicetype before.
Seems like it affected an integration for homey as well.

Have you installed the latest version of the custom component yet?
If so could you please try and change “inverter” on this line to “tlx”.

If it works please let me know and i’ll update the check to check if it is “inverter” or “tlx”

Unfortunately it does not work if I change ‘inverter’ to ‘tlx’. Do you know how I can sniff the Growatt app from my Android phone?

i do indeed, i wrote a small blog post about how i discovered the endpoints for future reference.
I only know how to do it with android though.

You’ll only really be interested in the “Getting the data i want” heading.

Then you can try getting the data via the example:

import growattServer
api = growattServer.GrowattApi()
login_response = api.login('<username>', '<password>')
#Get a list of growatt plants.
plants = api.plant_list(login_response['userId'])
deviceList = api.device_list(plants['data'][0]['plantId'])

def inverter_detail(self, inverter_id):
    response = api.session.get(api.get_url('newInverterAPI.do'), params={
        'op': 'getInverterDetailData',
        'inverterId': inverter_id
    })

    data = json.loads(response.content.decode('utf-8'))
    return data


print(inverter_detail(deviceList[0]["deviceSn"]))

And of course change the url, params and function name to fit your discoveries.
If you get an “op” with _two or _one etc. try removing it. I learnt after publishing that you get way more data if you remove those.

If you get the data you could try adding it to https://github.com/indykoning/PyPi_GrowattServer/blob/29c6d370621144c7a889573f7da3d422c04883e3/growattServer/init.py#L95

I’ll try merge and create a new version number.

Lastly for the actual integration you can add the new type to


Those are the mappings between data recieved from Growatt and data shown in Home Assistant

Also add the new list to https://github.com/home-assistant/core/blob/8cf0a01149b568fd3c4cbd1c7cb5b8ffa830cc5a/homeassistant/components/growatt_server/sensor.py#L278

And create a new elif to get the sensors for the new tlx

Then another elif will have to be added here

To actually get the data from the GrowattServer python package.

When all of that is done it will be ready to try and Home Assistant would probably be happy to merge the added functionality :slight_smile:

Hi! I have a growatt inverter but not a dongle wifi on it. How can I catch the data to expose on home assistant? I have to bought the dongle?

The integration that is in home assistant right now does require the dongle since it get the data from server.growatt.com

However there is a library to read from the RS232 port https://pypi.org/project/growattRS232/

So it would be possible for someone to make an integration for it.

2 Likes

The Growatt wifi dongle shows in my DHCP device list as an ESP_xxxxx device, same as all my other ESP2866 devices. I wonder if it would be possible to put ESPHOME on it and get the data out of it directly that way via local wifi.