Notifications
Clear all

Local monitoring and control of inverter - gaps in understanding

38 Posts
6 Users
10 Likes
1,283 Views
Majordennisbloodnok
(@majordennisbloodnok)
Noble Member Member
3809 kWhs
Joined: 2 years ago
Posts: 343
Topic starter  

Hi, all

My wife and I have reached the next step on our renewable energy journey and I find myself needing to fill in some gaps in my understanding. Your help, therefore, will be much appreciated.

The current situation

We have an array of 18 solar panels providing approximately 6.5kWp connected to a Growatt SPH5000 inverter and feeding a Growatt 6kW battery - both installed outside on one of our house's external walls. The inverter is grid-connected and we have an export MPAN allowing us to export under an Agile Outgoing tariff with Octopus Energy. We also have an Agile import tariff also with Octopus Energy and we have a SMETS-2 smart meter. The inverter uses a ShineWIFI-S module to talk with Growatt's cloud offering and my wife and I are able to keep track of what's going on both with ShinePhone apps on our phones and tablets and also with a web application of theirs. This has been installed and working fine for just under two years now so we have had a chance to iron out any initial setup wrinkles.

What's changed and what we want to achieve

About six months ago we switched from one of Octopus' flexible tariffs to their Agile import tariff. It made sense since our battery allows us to avoid the expensive 4-7pm slot and so analysing the figures shows it's a significantly cheaper option for us. That also means, however, that we are now being alerted to plunge prices and there have been several since we switched. We would like to make better use of this and that means having a greater degree of control over the inverter and battery, at least manually but preferably intelligently and automatically.

It quickly became obvious we would benefit from a centralised and local home automation provision. Since I work in IT, the many concerns raised on this forum about Home Assistant are largely irrelevant to me since I'm hardly a beginner to computing technicalities and since I also work with someone else who has implemented Home Assistant for their solar array, it seemed a logical choice. As a result, I now have a Home Assistant server running HAOS (the Debian flavour) on an X86-64 PC (a little old but still with an over-embarrassment of resources) and physically connected to a cat6 local area network. Connection to the Internet is via fibre to the premises, so there are most certainly no bandwidth or latency issues, but it is via a fairly commonplace domestic router so traffic logging is pretty much non-existent. The Home Assistant installation is working fine and has been configured to connect to, monitor and, where appropriate, control quite a lot of devices on the network. It also connects to MelCloud to monitor and control our Mitsubishi Ecodan ASHP via a cloud integration. We also, perhaps obviously, have another integration that communicates fairly comprehensively with Octopus' API and so we are able to see a lot of data including the day-ahead half hourly prices once released.

The problem is that we should be able to do the same kind of thing with our Growatt inverter but Growatt themselves have a history of putting roadblocks in the way of any home automation systems that keep customers from using Growatt's own cloud offering and user interface. As a result, I am rapidly losing patience with them and my hopes I will be able to integrate with their web API are fading quickly. However, I would prefer not to lose the functionality of the ShinePhone app and related web page since that allows me to occasionally check on the battery/export situation whilst away from home. That means I want to explore what may be possible in terms of creating some way of communicating directly with the inverter over the local network, preferably in a manner that still allows the ShineWiFi module to continue working in the same way it has done to date.

In particular, we want to be able to implement logic like "Our battery's full and we can see there will be a period of negative pricing during the night, therefore discharge the battery during a particularly profitable point during the rest of the day and then forcibly recharge the battery from the grid during the negative pricing half-hours." or "the forecast for the coming day is great charging weather but there are some really good export rates duing the morning therefore change the priority so any solar energy produced is exported until x time and then start piling into the battery."

What I do know

As previously mentioned, I am entirely comfortable with most aspects of IT and in particular the following concepts:

  • IT infrastructure and networking
  • Software development - not Python but that won't be a hurdle
  • using web APIs to both push and pull data

I'm also fairly obviously familiar now with what bits of kit we have dotted around and what (at least in a basic sense) they do.

What I don't know

For someone with a career in technology, I'm also remarkably luddite in some areas. As a result, any discussion in those areas really needs to be basic until the penny drops and I can grasp the concept properly.

To be frank, I really don't understand electricity and electrical circuits. I can understand metaphors when used to explain how something electrical works but any detail about implementation risks whizzing straight over my head.

I know for definite that the ShineWiFi module is using a DHCP address but for the life of me I can't narrow down which actual MAC address it is; I have a good suspicion but can't be sure. That means that whilst I know it communicates with the Growatt web API I can't be sure whether or not it may be possible for it to accept incoming traffic.

Since I know the ShineWiFi module is the -S version and therefore using the RS232 serial port, I also know the USB port should be free and also the RS485 port. How that might be useful, however, is less clear.

Whenever I've researched about local connection to devices like inverters and heat pumps I have seen conversations quickly raising the subject of modbus. Although I am aware modbus is just another protocol, I know very little about it. Even more, any of these discussions have also quite casually talked about adding resistors and such like to a modbus interface and that's something way outside my comfort zone.

Although the installers who provided the setup did an OK job, they were, unlike our ASHP installers, nothing special. They are certainly not likely to be familiar enough with non-standard setups to be able to comment on anything outside "install WiFi module and get it to connect to Growatt on the Internet". Nor do I know any other companies around who have that level of deeper knowledge.

What to do?

So concluding you can see I have a big gap to fill in my understanding before we can move forward. I need to work out:

  • What, if anything, I need to physically attach to our inverter (bearing in mind that it lives outside in the wind and rain) that would allow me sitting at my computer to interrogate it.
  • What I need to know in order to actually communicate with the inverter or whatever bit of gubbins I attach as the result of my first point.
  • Whether or not there is a ready-made or custom integration already in existence for getting Home Assistant to do the communicating rather than me manually.
  • What configurations (currently labelled in the Growatt web application in Chinese English and therefore largely impossible to understand for a layman like me) need to be changed from what and to what in order to affect the various priorities of where generated electricity is pushed, where demand for electricity is supplied from and how to tell the battery to discharge to the grid.

That's an awful lot of information for you to digest so thanks if you've made it this far. However, I'd really be grateful if you could, in fairly high-level terms to start with, provide any practical ways of achieving what we want to achieve with the setup we've currently got.

Many thanks

105 m2 bungalow in South East England
Mitsubishi Ecodan 8.5 kW air source heat pump
18 x 360W solar panels
1 x 6 kW GroWatt battery and inverter
Raised beds for home-grown veg and chickens for eggs

"Semper in excretia; suus solum profundum variat"


   
scrchngwsl reacted
Quote
(@derek-m)
Illustrious Member Moderator
13554 kWhs
Veteran Expert
Joined: 3 years ago
Posts: 4145
 

Posted by: @majordennisbloodnok

I have just completed a lengthy explanation of the need for a 'termination resistor' only to have it disappear into a black hole when I went to send, because the system had once more logged me out.

Editor: Please do something to stop this happening. Grrrr.

A more abridged version.

A termination resistor is required at the end of a transmission line to prevent pulse reflection, and therefore possible corruption of any subsequent data transmissions.

I can go into more detail if you wish, once my blood pressure has reduced.

 


   
ReplyQuote
Majordennisbloodnok
(@majordennisbloodnok)
Noble Member Member
3809 kWhs
Joined: 2 years ago
Posts: 343
Topic starter  

Thanks, @derek-m. I'm grateful for you putting in the time to answer, and therefore somewhat embarrassed for what I'm about to say.

What you said about the resistor makes perfect sense in isolation (I'm well aware of the need to terminate the old-style coaxial ethernet cable, for instance) but I'm not at the point where I can understand how it fits into my issue yet. I'm still at the more basic point of "can I talk across the network to any of the kit that's already installed and if not, what do I need to plug in where in order to do so?" Once I have an answer to that, I'm presumably then at a point of "what language do I use to talk with the kit or whatever I plugged in somewhere?" and once I understand that I'm reasonably confident my general programming experience and networking knowledge will take over.

My assumption is that your explanation about a termination resistor is relevant in terms of amending something I may have to buy and plug into the inverter. If so, I first need to know what that something is. As I mentioned, the gaps in my experience are quite profound and I can quickly go from a very good technical knowledge to literally none whatsoever in the course of a couple of sentences. I'm afraid I'm going to have to ask for a lot of forebearance in that regard.

105 m2 bungalow in South East England
Mitsubishi Ecodan 8.5 kW air source heat pump
18 x 360W solar panels
1 x 6 kW GroWatt battery and inverter
Raised beds for home-grown veg and chickens for eggs

"Semper in excretia; suus solum profundum variat"


   
ReplyQuote



(@fazel)
Reputable Member Member
1085 kWhs
Joined: 1 year ago
Posts: 124
 

Posted by: @derek-m

Posted by: @majordennisbloodnok

I have just completed a lengthy explanation of the need for a 'termination resistor' only to have it disappear into a black hole when I went to send, because the system had once more logged me out.

Editor: Please do something to stop this happening. Grrrr.

A more abridged version.

A termination resistor is required at the end of a transmission line to prevent pulse reflection, and therefore possible corruption of any subsequent data transmissions.

I can go into more detail if you wish, once my blood pressure has reduced.

 

 

select and copy the text before sending the reply if you expect this behavior from the system

 


   
ReplyQuote
(@derek-m)
Illustrious Member Moderator
13554 kWhs
Veteran Expert
Joined: 3 years ago
Posts: 4145
 

@majordennisbloodnok

My blood pressure has now reduced somewhat.

So you understand the need for the termination resistor. I believe that some devices may already have one fitted.

My experience with Modbus is on industrial control system using Programmable Logic Controllers (PLC), which was the original equipment for which Modbus was developed.

What I would suggest that you do initially is see if you can perform your desired control functions using the control module on the inverter, since if you cannot obtain the desired results using the inbuilt controller, then it may not be possible to do so remotely.

How do you tell the inverter to charge or discharge? Can you control the rate at which it charges and discharges?

I can explain more about the structure of Modbus if you wish, or you can just Google 'Modbus' and you should find plenty of information that even has some pretty pictures.

 


   
ReplyQuote
(@derek-m)
Illustrious Member Moderator
13554 kWhs
Veteran Expert
Joined: 3 years ago
Posts: 4145
 

@fazel

I don't expect this behavior from the system and normally hitting the 'back arrow' return the text. On this occasion it did not.

What I do find particularly annoying is the fact that the system seems to delight in logging me out, without having the common cutesy to inform me that it has done so.


   
ReplyQuote
Majordennisbloodnok
(@majordennisbloodnok)
Noble Member Member
3809 kWhs
Joined: 2 years ago
Posts: 343
Topic starter  

Posted by: @derek-m

@majordennisbloodnok

My blood pressure has now reduced somewhat.

So you understand the need for the termination resistor. I believe that some devices may already have one fitted.

My experience with Modbus is on industrial control system using Programmable Logic Controllers (PLC), which was the original equipment for which Modbus was developed.

What I would suggest that you do initially is see if you can perform your desired control functions using the control module on the inverter, since if you cannot obtain the desired results using the inbuilt controller, then it may not be possible to do so remotely.

How do you tell the inverter to charge or discharge? Can you control the rate at which it charges and discharges?

I can explain more about the structure of Modbus if you wish, or you can just Google 'Modbus' and you should find plenty of information that even has some pretty pictures.

 

Thanks, @derek-m

I am well aware that at least most of the functions I want to perform are perfectly well baked in. They are also theoretically possible through the ShinePhone app and the company's portal web application; the settings page is designed to allow it (if it's possible to get past a rather persistent and well moaned-about error message) so all the control capabilities are certainly designed to be available. It's just a matter of how to talk with the inverter to use them.

I have also found at least one document from Growatt that talks about the SPF(not H)5000 Modbus RS485 RTU protocol. I don't understand it, mind, but it still exists.

 

105 m2 bungalow in South East England
Mitsubishi Ecodan 8.5 kW air source heat pump
18 x 360W solar panels
1 x 6 kW GroWatt battery and inverter
Raised beds for home-grown veg and chickens for eggs

"Semper in excretia; suus solum profundum variat"


   
ReplyQuote
(@derek-m)
Illustrious Member Moderator
13554 kWhs
Veteran Expert
Joined: 3 years ago
Posts: 4145
 

@majordennisbloodnok

I don't have time to go into detail at the moment, but I should be able to do so tomorrow.

I would suggest that you read through the attached document which I have just located.


   
ReplyQuote
(@derek-m)
Illustrious Member Moderator
13554 kWhs
Veteran Expert
Joined: 3 years ago
Posts: 4145
 

@majordennisbloodnok

I will try to explain some of the information contained within the document I sent yesterday.

Data Format:

Data is passed between devices in a Modbus network in packets of a specified format.

The Master can request data from a Slave by issuing a request, which consists of the slave address, the function (read or write) and type of data (binary, integer etc.), followed by the data, with the packet being completed by the Cyclic Redundancy Check (CRC).

When the Slave receives the request from the Master, it will collect the requested data and return it in a packet format.

I am not certain exactly what software may be required on the Master to achieve this process, which others will no doubt be better able to help with. Have a look at the program in this attached file which was recently posted on the forum.

https://github.com/Mosibi/Midea-heat-pump-ESPHome

If you have further questions I will try to answer them.


   
ReplyQuote



Majordennisbloodnok
(@majordennisbloodnok)
Noble Member Member
3809 kWhs
Joined: 2 years ago
Posts: 343
Topic starter  

Thank you, @derek-m

Meanwhile I have been taking a look at both the unit itself and the installation manual for it (which I have attached here)

Right at the moment, I'm focusing on trying to nail down ANY physical interface that might be capable of being used to communicate directly with the inverter, and I'm leaving the how to actually do the communicating until later. It seems to me that the only available possibilities are:

  • Try to find some way in which the wifi module will actually respond across the network - tried quite extensively and so not holding out much hope, but if that were possible then that's the option closest to my comfort zone.
  • Try to find something that will plug into the USB slot which will either convert to something that acts like a network port or acts like a serial port. Not my preferred option since the USB slot is also necessary occasionally for firmware updates and such.
  • Consider removing the wifi module and getting a serial port to ethernet converter. Not ideal since it will stop the communication between the inverter and Growatt, thereby stopping their cloud offering from working.
  • Install a serial port splitter between the wifi module and the inverter and then attach a serial port to ethernet converter to the second RS232 socket I have then made available.

Are any of these practical alternatives? All of the above options that involve plugging something extra in do have the added complication that the inverter lives outside and therefore whatever I do will have to be weatherproofed.

 

105 m2 bungalow in South East England
Mitsubishi Ecodan 8.5 kW air source heat pump
18 x 360W solar panels
1 x 6 kW GroWatt battery and inverter
Raised beds for home-grown veg and chickens for eggs

"Semper in excretia; suus solum profundum variat"


   
ReplyQuote
Transparent
(@transparent)
Famed Member Moderator
8065 kWhs
Veteran Expert
Joined: 2 years ago
Posts: 1347
 

Please allow me to dive in here!

I've been communicating with Growatt inverters now for about a year, and I support the recommendation from @derek-m that you should use Modbus.
It's the most direct method to talk directly to the configuration registers and receive data in return.
The other methods are more tricky because of the network layers, and the fact that I suspect your inverter model is using two processor internally.

[Inverters with two processors require two files to be transferred when attempting a firmware upgrade]

Having said that, in my experience the response of Growatt's inverters to any commands sent to it is unreliable.

The SPF-series which I use, is oriented such that its focus is on keeping the load supplied.
It isn't straightforward to configure it such that you specify when it should charge the battery from the grid, especially when PV panels are also alive and supplying charge.
Those commands are battery-focused.

The internal clocks are useless in this regard.
You will need to leave them unset, and send timed commands over Modbus from your PC.

It is quite likely that you will need to use a relay to decouple the PV input(s) from your inverter during daylight if you wish to take advantage of Agile plunge pricing.
That's not difficult to achieve and I can tell you which relay to use if you need it.

 

You might find that there are occasions when the inverter doesn't cease to charge from the grid when the plunge-pricing period ends!

I've had this several times, and I've found no other method except a full re-start of the inverter.

For the SPF-5000 series, an inverter reset requires that it be connected only to the battery.
The grid-input and PV-input must be isolated when the re-start occurs.
It may be different for the SPH5000 of course.

 

Finally, until I read this thread and checked the specs for the SPH5000 I hadn't been aware that it was permissable in the UK to use a Growatt inverter which offers both

  • export to the grid
  • EPS (emergency) 240v AC output when there is a power-cut

I thought only Sunsync had received such approval.

 

I'd be delighted if you prove me wrong.
But let's sound a warning here, that there are inherent dangers in having a grid-tied inverter operating when the an outage is in progress.

It means that the EPS output can either use the grid to synchronise itself with 50Hz, or it can be supplied with 50Hz reference frequency from an internal oscillator.

Personally I don't like having such a feature.
But if you are going to have mains appliances in the house connected to both the standard 240c AC inverter output connector and the EPS connector, then you should be very careful to use double-pole switches/trips/contactors. Keep the neutral wires separate!

Anyone else reading this - please take note!

 

Save energy... recycle electrons!


   
ReplyQuote
(@derek-m)
Illustrious Member Moderator
13554 kWhs
Veteran Expert
Joined: 3 years ago
Posts: 4145

   
ReplyQuote
Page 1 / 4



Share:

Join Us!

Latest Posts

x  Powerful Protection for WordPress, from Shield Security
This Site Is Protected By
Shield Security