Lyve1981 / GrowattUsbModbus

Growatt ModBus => MQTT translation service
MIT License
23 stars 6 forks source link

Enable export control? #1

Open That-Dude opened 2 years ago

That-Dude commented 2 years ago

Hi Lyve, using your project to publish to the the registers could I dynamically enable export control on my inverter? This would be incredibly useful.

Lyve1981 commented 2 years ago

Yes, this is possible. The register number and value depends on your inverter, on mine it is 122

image

The message should look like this:

Export Limit Off

{
    "command": "writeholdingregister",
    "index": 122,
    "value": 0,
}

Export Limit enabled, driven by RS485 (meter)

{
    "command": "writeholdingregister",
    "index": 122,
    "value": 1,
}
That-Dude commented 2 years ago

Thank you, that's incredibly helpful. I have my ESP board with CH340 arriving today and can't wait to try this out.

Do you think I could also control the export rate by pushing data into the appropriate register?

Looking at this PDF (which correlates with your index value of 122) I think that I would need to add an integer into index 123? Although I don't understand the stated value range of -1000 to + 1000.

# limit export by 500 (Watts? Percent?)
{
    "command": "writeholdingregister",
    "index": 123,
    "value": -500,
}
Screenshot 2022-08-27 at 09 07 05
That-Dude commented 2 years ago

update: I received my esp8266 with CH340, flashed your sketch to it and everything worked immediately. It arrived just as the Sun was going down but I had time to read some input registers, and read/write the export holding registers. I'll experiment with setting the export control amount tomorrow. Thank you for your development efforts, this is such a useful tool.

Didou30 commented 2 years ago

mise à jour : j'ai reçu mon esp8266 avec CH340, j'ai flashé votre croquis dessus et tout a fonctionné immédiatement. Il est arrivé juste au moment où le soleil se couchait mais j'ai eu le temps de lire certains registres d'entrée et de lire/écrire les registres de maintien d'exportation. J'essaierai de définir le montant du contrôle des exportations demain. Merci pour vos efforts de développement, c'est un outil très utile.

Bonjour,

je n'arrive pas à compiler vous avez pris quel librairie pour l'esp 8266 ? merci de votre aide

bemilamedia commented 2 years ago

update: I received my esp8266 with CH340, flashed your sketch to it and everything worked immediately. It arrived just as the Sun was going down but I had time to read some input registers, and read/write the export holding registers. I'll experiment with setting the export control amount tomorrow. Thank you for your development efforts, this is such a useful tool.

Hi, I'm building my PV in the next few week (2,8KWp) and I want to you a Growatt Inverter because of the export limit functionality. Have you tested or found some more information about the register 123 and/or how to setup export limits dynamically?

This project is the first I found which also allow to write registers (especially the export registers) . Not only reading! And thats great because this is my only missing point to setup a dynamic zero export and charging an akku by a dynamic charger (I hope my setup will work - Automatization will be set in RodeNed on HomeAssistant).

Eventually -1000 to 1000 means -100% to 100% rate because it is in 0,1% steps? But I'm also not shure what -1000 is. It makes no sense to set -1000 = -100% and 1000 = +100%. confusing 0-100% would make more sense. Or values in watts

I have found another PDF: https://docplayer.net/168516144-Growatt-export-limitation-guide.html This declares other inverters. In this case they use register 202 for "on/off" export limit and 201 to set the limit in watts. (You can see it in the PDF. So, I think it is possible to set the limit in watts or %.... we just need to found the correct registers.

Edit: Or may it be possible that register 03 (or 04) is the right one to set a export limit?

That-Dude commented 2 years ago

The short answer is: I'm working on it.

The long answer: After a lot of research I determined that in order to make export control work you need two things:

  1. To enable export control, you can do that by either enabling 'export control' in the invert GUI or by turning it on with this project.
  2. . You will need either a CT clamp or Eastron meter (SDM260 in my case) attached to the 2nd modbus ports that the invert has.

I don't want to use a CT or a meter, I want to control the export process directly. So I'm going down the route of building an ESP8266 device to emulate the functions of the Eastron meter.

I'm making progress, I've managed to emulate the 7 input registers that the Growatt requests from the meter and I'm able to set the values to whatever I want, which I suspect is all that is required. Next I plan to integrate MQTT support so that I can set the values from Home Assistant where I've already got all of the data that I need.

I'm working away from home for the next 9 days so I can't actually attach it to the inverter to check if it works. Once I've got it all figured out I'll create a project on Github.

bemilamedia commented 2 years ago

Hi "that-Dude", holy shit.... this sounds really awesome. WOW I wish I can give you any kind of support but my experience in programming are more like a "rookie".

At the moment I use a shelly EM3 and a PM 1 Plus to collect the in and outs of my electricity. So your way sounds fantastic. --> Manage everything in HA.

That-Dude commented 2 years ago

I'm using Shelly devices too. There's a option to have them drop their data directly into an mqtt server, im working on reading those mqtt values directly. I also want it to work in a dead man's hand fashion, so if the mqtt goes down it limits the inverter to sensible export values that you choose in advance.

The home assistant aspect is primarily for reporting and will come later I think.

I'm really not a dev, I've only learned Arduino and c++ just for this project. But it's been fun figuring it all out. The whole arduino platform is amazing once you get to grips with it.

Lyve1981 commented 2 years ago

Nice to see that this project is useful for you guys. Unfortunately I don't know how to set the limit in watts either. Weird that the limit in percent can be set to negative values, doesn't make much sense to me?

For this to be able to work at all, a meter is needed indeed (or an emulation, as @That-Dude is suggesting) because this is the only way the inverter knows about your house consumption.

bemilamedia commented 2 years ago

I'm using Shelly devices too. There's a option to have them drop their data directly into an mqtt server, im working on reading those mqtt values directly. I also want it to work in a dead man's hand fashion, so if the mqtt goes down it limits the inverter to sensible export values that you choose in advance.

The home assistant aspect is primarily for reporting and will come later I think.

I'm really not a dev, I've only learned Arduino and c++ just for this project. But it's been fun figuring it all out. The whole arduino platform is amazing once you get to grips with it.

Hi that-Dude, is there already news regarding your version?

I'm building my solar system here right now. The Growatt MIC300TL-X is already ready. I think so in 2 weeks I have everything mounted and then it goes on with solar production. :-)

Yes with Arduino I have a few years ago also once "tinkered". Is already fantastic what is possible with it. Therefore, I will also work in the course of the solar project again. thumbsup

bemilamedia commented 2 years ago

Nice to see that this project is useful for you guys. Unfortunately I don't know how to set the limit in watts either. Weird that the limit in percent can be set to negative values, doesn't make much sense to me?

For this to be able to work at all, a meter is needed indeed (or an emulation, as @That-Dude is suggesting) because this is the only way the inverter knows about your house consumption.

Yes I think this register with percent settings, is the wrong one. It doesn't make any sense to use this. It complete weird to set something like this in negative range. I looks like "that-dude" has found the right registers to set a export limit. So if this is possible, its a great solution.

That-Dude commented 2 years ago

Sorry guys I arrived home and had to immediately fly back out to another job (I'm a commercial photographer). But I grabbed the kit necessary to work on this while I'm away.

I'll start a Github project in the next couple of days so that you can help test it as I don't have access to the inverter while I'm away, but I can build out the code.

To answer the question above regarding the correct registers to set on the modbus to enable export control. Why not turn on export control from the inverters little built in GUI and then see what registers change when you dump them? That's my plan when I get back home in a few days.

That-Dude commented 2 years ago

Apologies @Lyve1981 I didn't mean to hijack your thread and I appreciate you allowing us to riff while I get this off the ground.

That-Dude commented 2 years ago

I've published an untested version on my code here if any of you guys would like to give it a try?

https://github.com/That-Dude/Emulated-Eastrom-SDM-Power-Meter/

bemilamedia commented 2 years ago

I've published an untested version on my code here if any of you guys would like to give it a try?

https://github.com/That-Dude/Emulated-Eastrom-SDM-Power-Meter/

I test it as soon as possible. At first I have to mount my 9 Solarmodules on the wall. ( I'm waiting for my ordered 200 Screws to build my individual wall mount )

Diddlik commented 1 year ago

Hi guys, any news in this direction? Is it possible to write same register to manage dynamically export limit?