splitbrain.org

electronic brain surgery since 2001

Growatt & Home Assistant

My solar installation uses a Growatt SPH 8000 inverter and of course I wanted the data it provides (produced, used, stored energy etc) in Home Assistant. That was relatively easy using the the Growatt integration available. This integration was broken by Growatt at the end of September.

So I had to find a different way and that proved to be somewhat complex, with many slightly different options available. In this (loooong) post I try to explain the different available options and then tell how I configured everything for my setup.


Main Options available

There are basically four ways to integrate Growatt inverter data into Home Assistant:

1. Core Growatt Integration

This is what I was running until it broke. It was written by @muppet3000. He reverse engineered the API the ShinePhone App uses to communicate with the Growatt servers. Basically the integration simply pretends to be the app downloading data.

The data flow looks like this:

Advantages:

  • Easy to set up
  • Already integrated with Home Assistant
  • ShinePhone App can be used to configure the Inverter

Disadvantages:

  • It's broken
  • It will be removed from future Home Assistant releases
  • Unoffical API can change anytime

Read more about it

2. HACS Growatt Integration

This is basically the same as above. Also maintained by @muppet3000, but is independent of HomeAssistant releases. It received a temporary fix for the original problem just yesterday.

Advantages:

  • Easy to set up if you already use HACS
  • 1:1 replacement for the core integration
  • ShinePhone App can be used to configure the Inverter

Disadvantages:

  • Unoffical API can change anytime
  • Will not receive any updates

Read more about it

3. ESPHome

This is the most radical solution. It completely removes Growatt from the equation. The data logger contains an ESP chip, so you can “simply” overwrite the Growatt firmware with ESPHome and have it log directly to your Home Assistant.

It requires some simple soldering and a firmware flasher. The process is similar to what I described at Liberating the SONOFF Power Elite.

This is really the simplest data flow:

Advantages:

  • Least amount of involved components, thus pretty robust
  • No data leaves your home

Disadvantages:

  • You can't configure the inverter
  • No ShinePhone App anymore

Read more:

4. Grott

Grott is an OpenSource project by @johanmeijer. The idea simple: since you can configure the data logger and tell it where it should log to, we can tell it to log to our own service and then forward all the logs to Growatt. Basically a Man-in-the-Middle proxy. And since the data packets Growatt receives are exactly the ones the data logger sent, they should not be able to block it.

Grott is unrelated to Home Assistant. Instead it sends the data it receives to an MQTT broker. In turn Home Assistant can get the data from that broker then. The flow looks like this:

Advantages:

  • Works with the standard data logger firmware
  • ShinePhone app still works and can be used to configure the inverter

Disadvantages:

  • A somewhat more complex setup
  • Still reliant on Growatt's servers because their server's answers need to be fed back to the data logger

Read more about it

Grott Integration Options

From all the integrations above, Grott is currently the most powerful one. However, once you decided to use Grott, there are still a few things to know about.

Grott Server

This is the newest work by @johanmeijer. It is a companion to Grott, that replaces the Growatt Server. It's still experimental, but the idea is to remove the reliance on Growatt completely, but still allow for configuration of the inverter.

I think ideally one should be able to use the Growatt server and fall back to this whenever their servers are down (which happens surprisingly often) but this is not yet supported.

Read more about it

Grott HA Extension

This is an extension for Grott which enables MQTT autodiscovery for Home Assistant. What this means is when you use Home Assistant's MQTT integration, it will automatically create all the entities for the data that Grott is sending to MQTT. This was initially written by @egguy and is available in the examples directory of Grott.

Of course you could also manually create the entities, but that seems tedious.

Read more about it

Grott Add-On

This is another project by @egguy. It packages Grott and the Grott HA Extension into an add-on that you can install and run via the Home Assistant Supervisor. If you're running Home Assistant OS on a Raspberry Pi, you probably want to use this to run Grott.

Read more about it

Grott Home Assistant Custom Component

This is the new project by @muppet3000. It is an alternative to the Grott HA Extension. This time it's a component for Home Assistant that creates the entities for you. The advantage is that it can do more than simply mapping MQTT data to entities. It can also use MQTT data to calculate things and make that available as additional entities.

This will give you all the data the original core Growatt Integration gave you.

Read more about it

Hardware Troubles

After I understood all of the above, I knew that I wanted to run Grott. This means that the data logger needs to be reconfigured to send data to the Grott server in your local LAN.

Now my data logger was a ShineWiFi-X. The trouble with that data logger is that it can only be configured to connect with WiFi networks that have no special characters or spaces in their password. This is not a hardware limitation, just stupidity implemented by the Growatt software developers.

Of course my WiFi network has a complex password. And I have dozens of devices configured to use it. So changing the password was not an option. Instead I had created a guest network in my router and gave it a simple password. That worked as long as the data logger only needed to communicate with the Growatt servers on the Internet. But what clients on the guest network aren't allowed to do, is to access any server within the local network. So this was not gonna work for running Grott.

Instead I opted to buy a ShineLan-X data logger which does the same thing but uses a wired LAN connection. They are surprisingly cheap, I got mine for about 10EUR off an ebay seller1). Of course I had to wire up some more LAN cable in the basement but luckily it fit into an existing cable channel.

What surprised me, was how easy it was to add this new logger to your existing Growatt account:

  • Click “Add Datalogger”
  • Enter the serial number (printed on the back, or available in the web interface of the logger)
  • Enter the check code (under “Device State” in the web interface of the logger)
  • Select your plant (if you have multiple inverters)
  • Click done

You can now seamlessly switch between different loggers, the Growatt servers will accept data from any registered logger.

The logger worked fine for a few days until it suddenly stopped working. Diagnosing a bit, it seemed to reboot right after starting up. I suspected a hardware defect, so I contacted the seller for a refund/replacement.

The seller was a bit reluctant to do a replacement right away, because with a 10EUR article there isn't any profit when you have to pay for shipping twice. So instead he guided me through a few diagnostics, asked me for the serial numbers of the logger and inverter and got in contact with Growatt. A few hours later the logger magically started working again and he told me that Growatt had remotely updated it to a newer firmware.

Kudos to the seller for putting quite some work into supporting me (via Whatsapp)! I am a bit wary about Growatt being able to update my devices on their own, though… but of course I'm happy it's working again.

Software Setup

I am running Home Assistant OS on a Raspberry Pi. So for my setup I decided to use the following:

  • Grott Addon
  • Grott Home Assistant Custom Component

I already had HACS, the Mosquitto broker Addon and the MQTT Integration installed already, because I use them for other stuff. I don't remember their setup in detail, so I can't write it down here. But IIRC there wasn't much configuration involved after installing.

Removing the old Growatt Core Integration

I started by only disabling the old broken integration, but I think in hindsight removing it is the better way. Otherwise you may end up with weird entity names ending in “2” later…

Settings → Devices & Services → Growatt Server → Menu → Delete

Confirm the removal and it's gone.

Installing the Grott Addon

Next we want the Grott Server. Since we use the Addon for that, we can use the Add-On Store.

Settings → Add-ons → Add-On Store → Search for “grott” → Pick “Grott stable branch” → Install

Once installed, I enabled “Start on boot”, “Watchdog” and “Auto Update”.

Switch to the “Configuration” tab

  • Inverter type: SPH (depends on what Inverter you have)
  • Enable grott MQTT
  • Disable Home Assistant plugin

The last two settings are needed because we want to use the homeassistant-grott component in the next step.

Finally hit “start” on the Info tab.

Reconfigure the data logger

For the ShineLan-X stick, you can simply open it's web interface and log in with admin/admin2).

After login, switch to the “Network Setting” tab. Turn off “ResolvDomain” and enter the IP address of your Home Assistant. Click “Save”. You should get a CONN OK indicator.

Now when you go to the Log tab of the Grott Add-on you should start seeing “Growatt packet received” lines after a few minutes.

Adding the Grott Home Assistant Component

This is really easy. Basically follow the steps from the README for installation (prerequisites have been done by now).

Basically:

  • Add the repository to HACS
  • Install the component via HACS
  • Restart Home Assistant
  • Add the new integration as usual
    • Leave the Device ID empty
    • Enable the calculation of additional entities

You now should have all your data in Home Assistant.

You can have a look at this file to learn how the new entity names relate to the ones the old core integration used. Theoretically you should also be able to use this file to remap the new names to the old ones and keep all your statistics. However for me that didn't work, so I left it out and just use the new default entity names…

Easy, eh? ;-)


PS. I hope this article helps clearing up some confusion about the different options and tools available. If you have questions, I am probably the wrong guy to ask. Instead I recommend asking in the Home Assistant community.

Tags:
growatt, solar, home-assistant
Similar posts:
1)
seems the price doubled since then
2)
For the WiFi version you need to adjust the logging target via the ShinePhone App or Growatt website - there are some hints here