muppet3000 / homeassistant-grott

Home Assistant Integration for Grott - MQTT
MIT License
76 stars 17 forks source link

Help with controlling inverter directly #89

Open slovely opened 5 months ago

slovely commented 5 months ago

Hi, hoping to pick your wonderful brains again with a query about setting/reading inverter options via a direct request.

I'm using grott and home assistant and it's working brilliantly. I know that GrottServer allows you to control the inverter, but at this point in time I would rather keep with the official growatt site if possibly. I'm wondering if you have any bright ideas on how I can set and read the following item in the inverter settings:

image

I did resort to using Playwright to automate a browser session, which worked for a while but now just times out loading the page. Feels like somehow they are blocking my requests.

I've had a look at the code for grottserver, but my Python isn't up to much unfortunately, so I'm struggling to understand exactly what it is doing.

Is there a way I can fire a request of some kind at the datalogger IP to read/write the setting? Or does it rely on the open connection to Growatt (or grottserver) to send/read the inverter settings?

Thanks for your help.

(PS This is an SPH inverter)

tabascoz commented 5 months ago

Hi there, i think so.

But struggling to get what is this parameter related to. Would it be to get back to grid once the SOC reaches 10%? please confirm and I'll check and revert.

Cheers, Fernando

slovely commented 5 months ago

Hi @tabascoz

Yes, this is the SOC when the batteries will be, in effect, turned off and the load will be supplied by the Grid (or PV if available).

The reason for this is to automatically stop the battery when EV is charging - want that from the grid rather than draining house battery.

muppet3000 commented 5 months ago

The request to the datalogger IP would need to be wrapped in some form of modbus/growatt wrapper that I really don't know enough about to be able to advise on. I've been using grottserver for about a year now and have a series of curl requests to dynamically configure my AC charging etc overnight based on the predicted PV generation for the next day. I'm half way through writing a python library for it which I'll then write a wrapper around so we can use it as a HomeAssistant integration, I just haven't had the time recently. I'll happily share some stuff tomorrow on how my grottserver setup is working (not at my desk currently).

Unrelated, I've been having no end of problems with the datalogger from my system since the weekend after I had a power outage to do some electrical work. I think I'm one of the only people using the older style ShineLanLink box instead of a Wifi stick and I think something is interfering with the RF signal between them. I've got a wifi stick coming in the next couple of days that I'm hoping I can switch over to and it'll solve my problems.

tabascoz commented 5 months ago

Short answer: parameter 37. for ex:

curl -X PUT '192.168.0.xxx:5782/inverter?command=register&register=37&inverter=SERIALNM&value=10'

Would do the trick. However, some considerations. to use % values it's only possible if you have the inverter set to talk to the battery bank BMS (battery type set to lithium). I have it and tried with mine, the parameter in my inverter is exactly at 10% like you want, but I've tried to change it from Grott and it didn't work.To be honest this is the one of the (rare) only parameters i never tried to change using Grott as it is ( from my implementation perspective) it a "fail safe" value. To be used only if the automation, for any given reason, don't kick in.

I have an EV also and i do charge it from batteries. I am almost grid-free and I aim to not spend all the battery with EV charging.For that I have Home Assistant and Nodered doing the automation and I can control the parameters and solar production forecast to orchestrate solar utilization.

So you could do the same by changing the inverter mode from SBU to UTI and it would stop using batteries immediately.

slovely commented 5 months ago

@tabascoz Thanks - that looks like a request to GrottServer though, isn't it? I'm not using grottserver at the moment (only grott), as for now I want to keep using the official website/app. Might change that in the future though!

@muppet3000 Ahh, I had assumed that grottserver needed to do the modbus stuff so thought you had figured it out :) Probably my lack of knowledge on how it all fits together! I just assumed that was how grottserver sent those requests to the inverter.

Thinking about it - if I change a setting on the Growatt website, does that go "through" grott? I wonder if I could put a call into grott to make it send the correct message (not sure if I can figure that out!) when I request it, rather than the website.

muppet3000 commented 5 months ago

When you change the setting via the website yes it flows through grott, I don't understand enough about it's implementation but the grottserver spoofs the logic of the growatt servers. There may be some specific logic that you could extract from that, however it wouldn't surprise me if there's some form of handshake between grott and whatever 'server' it's talking to, and you'd need to complete that as well.

Last time I looked at the grottserver discussion someone was working on a version of grott/grottserver that allowed data to be published to both the growatt servers AND grottserver which would help with the problem, but I have no idea where that has got to.

slovely commented 5 months ago

Yeah - you know I made the classic mistake of thinking it was you that wrote grottserver! 🤦

I probably opened this in the wrong place - appreciate your help and ideas though! The HA bit that you did do is working great!

typxxi commented 4 months ago

The request to the datalogger IP would need to be wrapped in some form of modbus/growatt wrapper that I really don't know enough about to be able to advise on. I've been using grottserver for about a year now and have a series of curl requests to dynamically configure my AC charging etc overnight based on the predicted PV generation for the next day. I'm half way through writing a python library for it which I'll then write a wrapper around so we can use it as a HomeAssistant integration, I just haven't had the time recently. I'll happily share some stuff tomorrow on how my grottserver setup is working (not at my desk currently).

Unrelated, I've been having no end of problems with the datalogger from my system since the weekend after I had a power outage to do some electrical work. I think I'm one of the only people using the older style ShineLanLink box instead of a Wifi stick and I think something is interfering with the RF signal between them. I've got a wifi stick coming in the next couple of days that I'm hoping I can switch over to and it'll solve my problems.

1

thanks a lot for the general update regarding writing registers to the inverter cause I have finally been able to finish my DIY Hybrid system

2

I was on the edge to look for such LAN Control Box you had been using which is based on 868 Mhz or so and control up to 8 inverters or so.

3

Yes, I would love to be able to use what you have described to charge during off peak hours (here usually only during nights and surplus wind power from the north sea during night with low demand) in case the solar for cast is bad.

4

Our system is now working with the Eastron SDM630 and 1 SPH 4600 with 4 more MiN 4600 along with a 14 kWh EVE battery inside an EEL V4 box with a JK inverter BMS which means a solid metal EEL solid metal with all the brackets, screws, manual and parts needed to use it as a rack box for brand inverters from sma , deye to growatt - and most important: this case fullfills the mandatory upright position of the LFP cells cause all the towers have been forbidden by EVE as EVE emphasize that the LFP cells was not designed to be laid flat with the fuse on the side instead of the top. Therefore: here in germany I could get the EEL Box incl. JK 200 A BMS with up to 2 A balancing current for 500€ which is a good product with compression of the cells and 2 nice PCB bridges each supplying 8 cells with balance currents.

If you have to pay 200€ for the BMS alone you will have to pay a lot for the tiny bits and pieces from the terminals (10€) over terminal covers / protection and MCB for DC plus cables plus crimping lus lug nuts, the foam and the Epoxy sheets (over 40€) and many more bits and pieces like a precharge resistor and the right FTDI Adapter (8€) or Modbus Cable (6€). If you get the well packaged kit you will get a good full metal case (not cheap made cause it looks like made in germany) with all you need except battery cables and LAN cable.

5

Off topic but a WARNING: We had bought first december 2023 a SEPLOS vertical tower first and had been preparing the built of the 16 EVE LF280K cells into that SEPLOS MASON 280 LA tower until we got a warning from EVE in March 2024 that in such cases the warranty for the cells would no longer exists cause the horizontal position of the cells would violate EVE's warranty. The hoizontal position will reduce the capacity due to the electrlytes no longer covering the full active material and lower cycle life. This hit us hard cause we had to relocate the inverter and the battery cause the footprint of the vertical battery is tiny especially below such SPH inverter on the wall (44 x 28 cm and 90 cm high). Everything had to be redesigned cause we did not had the depth nor the width at that point needed for a black rack battery which is over 41 cm deep and 70 cm long.

6

I hope to see your "switch integration" coming soon cause right now I am the manual master doing the stuff via ShineWifi App or browser, I mean activationg AC charging and from when to when and what not. Growatt did work quite stable so far which means I had no issues I got aware of. It is just working fine. And in case there are issues these are others like a "longer Home Assistant" restart when grott addon had not been started already which seems to be one of the latest Addons or parts HA is starting. Only then I get again aware of the existence of the Grott Addon and Grott Integration working in the back ground.

7

I am not sure if you have a clue about the SPH or not but I am looking for the data the Growatt inverter should get or read from the eastron SDM630 smart meter like the current load on each phase or consumption. But I am not sure which sensor is delivering what.

I had hoped for a kind of sensor that is presenting the net LOAD before the growatt production. Right now I can only get what I am importing from or exporting to the grid, but not really the current consumption. I mention this cause the longer you are getting into the hybrid thing the more you get aware how lost you are or how far behind the data are lagging with the 1 to 5 minutes of the Growatt cloud being behind. I am using VNC to have access via a PC to the JK BMS where I can see the W going in and out of the battery so I can see an instant reaction if I change the Growatt settings. Otherwise I would have to go up onto the roof to the inverter shed and check the values on the display. HA is far behind cause Grott is far behind cause Growatt wants that with the 1 to 5 minute average reporting they are using. Therefore I have to connect the second RS-485 port of the SPH single phase series (which is called 485-2 behind the CAN port) to the same old laptop I am using to monitor the battery with the JK BMS Windows Software (you could achieve the same with a tablet and the JK BMS App for android, but I had a 10 year old 10 inch 4 GB laptop which is good for such basic tasks). I need live data from the system and modbus plus ftdi adapter seems to be the only way to get access to growatt SPH inverter real time data.

8

I guess I need to have to find a new way to get real time access to (only) the SPH inverter in Home Assistant . That is my current challenge after I have gotten the JK BMS battery data via Bluetooth and the HomeAssistant addOn BT Monitor inside HA.

typxxi commented 4 months ago

Thinking about it - if I change a setting on the Growatt website, does that go "through" grott? I wonder if I could put a call into grott to make it send the correct message (not sure if I can figure that out!) when I request it, rather than the website.

ATTENTION: the architecture and the awareness of the architectur is the most important topic you always have to be aware of as GROTT USER

From the moment you are using Grott server or the HA grott server add on your growatt settings are relying on a working HA instance with Grott AddOn or GROTT incl. working local network and internet access. If you reboot HA and the reboot takes longer then be aware that the Grott Add On usually starts as one of the latest piece of code.

In case that such HA reboot will take longer for whatever reason while you are working on different stuff and then after 5 or 8 minutes start working on the settings via Growatt Web Site or ShinePhone App then those settings will never reach the server. You will not even get real time data when accessing cause usually you will get data from your local systems cache.

Cause to access the growatt cloud server data via web or app you will need a fully running HA Server from the moment you have changed the IP in the WiFi Sticks - or you have to make the changes directly on the Growatt SPH inverter with the few keys and its tiny display, even though not everything can be changed this way.

Just a reminder and warning to be aware: Using Grott Addon or Grott Server means HA or Grott Server must be running fully and if things via WEB or App do not work out as expected you need to check first local LAN and WIFI, your working internet connection and finally if HA Grott Addon is running.

Put a sticker on the inverter just to give you a visual reminder every time you come along the inverter in case one day things might look not right.

Otherwise you will -over time - loose the memory about the architecture you are using and in 2 years a case might happen as here where the HA reboot took about 40 minutes or so while Growatt cloud and app seemed to be not working properly somehow !

It was a long way to figure out what was going wrong And that was one reason that we plan to switch from the Wifi stick to a modbus direct connection between HA server and the SPH inverter just to see the instant feedback from the server if you change the settings which I can cross check via VNC looking at the JK BMS app on the old Laptop cause that is also Modbus connected to the laptop.

And this way I can see the Growatt SPH reporting to charge with 3257 Watts from the panel into the battery while the JK BMS is reporting to receive just 3000W (Attention: the growatt figures shown here are the average of the 60 seconds before the screenshot cause my stick reports every 60 seconds which you can check via Web how old the current figure is).

Due to the reason of roughly 9% difference (we are speaking about DC figures on both sides and the fact that JK and Growatt are reporting the same battery voltage (just 3 millivolt deviation) we believe that the JK BMS is undermeasuring cause based on JK the 14,3 kWh nominal capacity would only deliver 12,3 kWh from the very top 3,65V to the very bottom of 2,5V (both switches kick in when the first cell will reach these limits).

Here is a screenshot of such situation from yesterday. image

With the SPH now working with the battery the whole world has changed for us cause there are many things to tweak and be aware of.

typxxi commented 4 months ago

trick

Would do the trick. However, some considerations. to use % values it's only possible if you have the inverter set to talk to the battery bank BMS (battery type set to lithium). I have it and tried with mine, the parameter in my inverter is exactly at 10% like you want, but I've tried to change it from Grott and it didn't work.To be honest this is the one of the (rare) only parameters i never tried to change using Grott as it is ( from my implementation perspective) it a "fail safe" value. To be used only if the automation, for any given reason, don't kick in.

Not sure if you can set the SOC below 10% cause via interface on the inverter, the web or app you can not go below 10%.

That was the reason to use a different trick to use these 10%.

I have a battery of 16 EVE LF280K cells with a JK BMS. To use these 10% - not able to change the growatt inverter settings - I have increased the battery cell size in the JK BMS from 280 Ah to 311 Ah. So once the battery is fully charged (the 100% is set by the first cell that his the cell charging limit of 3,65V) the JK BMS is overreporting the real SOC and the only thing to remind is that the USEABLE SOC is from 100% to 10%. Usually the battery runs out before the Growatt 10% are reached cause 1 cell will drop below 2,5V and kick the JK BMS to turn off the battery.

ONCE AGAIN: the SOC is wrong on the SPH display and JK BMS Apps - but in HA I convert the 90% reported by JK BMS back into the real figure which means just 10% less or real SOC in HA 81%.

And I use the kWh capacity remaining cause the most people have a better awareness for kWh than Ah which always needs the voltage of the battery to get a real impression what is left.