mkaiser / Sungrow-SHx-Inverter-Modbus-Home-Assistant

Sungrow SH Integration for Home Assistant for SH3K6, SH4K6, SH5K-20, SH5K-V13, SH3K6-30, SH4K6-30, SH5K-30, SH3.RS, SH3.6RS, SH4.0RS, SH5.0RS, SH6.0RS, SH5.0RT, SH6.0RT, SH8.0RT, SH10RT, SH5.0RT-20, SH6.0RT-20, SH8.0RT-20, SH10RT-20, SH5.0RT-V112, SH6.0RT-V112, SH8.0RT-V112, SH10RT-V112, SH5.0RT-V122, SH6.0RT-V122, SH8.0RT-V122, SH10RT-V122, SH4.6R
325 stars 83 forks source link

None of the configuration works #46

Closed Louisbertelsmann closed 1 year ago

Louisbertelsmann commented 1 year ago

For me, none of the configuration stuff works. I‘ve also got a SH10RT inverter, but it just won‘t work. I tried to set the device to force charge, but none of the options seem to work. I‘ve tried it in the normal self-consumption mode and also the forced mode. The automation gets triggered, so I don‘t think that‘s the problem. It must be somewhere between the modbus config and the inverter. I‘m also running the code version from the 20th january 2023.

dylan09 commented 1 year ago

You have to do 3 steps for this to get it working:

  1. Set the desired charging power set_sg_forced_charge_discharge_power
  2. Select Forced charge from set_sg_battery_forced_charge_discharge_cmd
  3. Select Forced mode from set_sg_ems_mode

And then, after a short while, the inverter should begin charging the battery. Could take a little while before it starts.

If this doesn't work try to force charge inside the iSolarCloud app.

Louisbertelsmann commented 1 year ago

I did try that, but it just doesn't seem to register correctly. I just want it working inside Home Assistant. When I change the power, the register battery_forced_charge_discharge_power still reports 3900W. Even if I change it to something completely different.

mkaiser commented 1 year ago

What does the GUI say, if you change the value and wait for one minute or so?

The modbus register behind is not updated very frequently. Unfortunately the automation can not retrigger an immediate modbus register update. So you select a new value and need to wait for a certain amoiunt of time, until the next refresh of the modbus values

Louisbertelsmann commented 1 year ago

If I change the forced charge discharge power, it takes a few seconds and then it updates sensor.battery_forced_charge_discharge_power. The same thing applies for the other two registers. I change it and the corresponding sensor also changes. The problem is, that it doesn't do anything. The battery doesn't draw any power from the grid. If I change it in the ISolarCloud app, it works. I just want it working in Home Assistant, so that I can disconnect it from the cloud and only use the WiFi Dongle for Firmware-Updates.

Louisbertelsmann commented 1 year ago

Whoops, restarted my inverter and forgot to turn on the breaker to the grid. Just turned it on and will try again in a few minutes.

Louisbertelsmann commented 1 year ago

Takes a few minutes to start, but it works now. I don't know what was wrong this morning, but I just updated to the newest code and it somehow works now.

dylan09 commented 1 year ago

I noticed today that battery_forced_charge_discharge_power is also respected when discharging in self-consumption mode.

Maybe someone could check if that is true. In that case it would be better to rename the sensor.

Louisbertelsmann commented 1 year ago

Would love to try it, but I don't exactly unterstand what you mean. Could you elaborate a bit more on what exactly happens?

mkaiser commented 1 year ago

just checked this and it works for me. I can limit the battery discharging power with "set_sg_battery_max_discharge_power"

Also I could successfully limit the forced charge discharge power

Can you double check? It is easy to mix them up, because they look pretty much alike:

Louisbertelsmann commented 1 year ago

Yup. Checked it. I can limit the forced charge and discharge power using set_sg_forced_charge_discharge_power. That is very accurate. With set_sg_battery_max_discharge_power it's always a bit under. If I set it to 200W it only discharges with about 112W. I think that's normal, because I've seen it in the Local Access of the WiNet-S Module. If the BMS limits the battery current to 6A it only takes about 5.4A. set_sg_battery_max_charge_power it's pretty accurate. Just 4-6 watts over what I've set. I set 200W max charge power and it takes about 204-206W.

dylan09 commented 1 year ago

Checked registers:

Load on inverter is > 5.000 W. Nearly exactly 1.000 W were taken from the battery and the rest is coming from grid. But I will double check again if my battery is charged again. Actually no sun here in germany.

Blue is battery discharging power, green is power taken from grid. EMS setting is Self-Consumption mode (Default).

Bildschirmfoto 2023-01-24 um 21 08 03

Sorry. Y-Axis is missing in image. But the maximum for blue line is at 1.000 W.

Louisbertelsmann commented 1 year ago

For me, if I set the EMS-Mode to Self-Consumption the forced charge discharge doesn't do anything. Only the max charge/discharge do something in self-consumption mode. What I can see is that your battery discharge is limited by the forced charge discharge power? I set mine to zero and I am still using my battery. Also, there really isn't any sun in germany where I live. I generated 2.5kWh today. I've got 12kWp on the roof. The fact that another part of the roof is blocking the sun in the morning also doesn't help. In the summer that isn't really an issue, because the sun rises pretty quickly, but during the winter it's pretty much always pretty low...

mkaiser commented 1 year ago

Checked registers:

  • sg_battery_max_charge_power has value 10.000 W
  • sg_battery_max_discharge_power has value 10.000 W
  • sg_forced_charge_discharge_power has value 1.000 W

Load on inverter is > 5.000 W. Nearly exactly 1.000 W were taken from the battery and the rest is coming from grid. But I will double check again if my battery is charged again. Actually no sun here in germany.

Blue is battery discharging power, green is power taken from grid. EMS setting is Self-Consumption mode (Default). Bildschirmfoto 2023-01-24 um 21 08 03

Sorry. Y-Axis is missing in image. But the maximum for blue line is at 1.000 W.

Could you try other values for discharge power?

In your screenshot it looks like there is 1/10 of the 10.000 W discharge power being used.

In case you have a inverter model that interprets the discharge power slightly different (factor 10), that could explain that behaviour

Whats your inverter model?

dylan09 commented 1 year ago

Yes. I will try some other values set the charge and discharge values to some other value than the default 10.000 W. But for the next day the forecast says no sun for the place where I live 😫

Maybe it could also be an EMS function. Limit the discharging power due to battery SoC or other conditions. Nothing important or a bug. Only a quick observation yesterday.

So I am very happy with the configuration for the Sungrow inverter. Great work. In the next few weeks I have to learn a lot about the inverter and how it works.

mkaiser commented 1 year ago

No sun here in Bielefeld, germany , too :/

I used the forced charge feature for an hour to have 10% SoC test the charge / discharge power settings.

Louisbertelsmann commented 1 year ago

Maybe it could also be an EMS function. Limit the discharging power due to battery SoC or other conditions.

I can say, that the BMS of my Sungrow SBR128 limits the current in certain conditions, for example when the battery is almost empty, it's too hot or too cold. When it's at about 95% it also limits the charging current.

GrandAmmor commented 1 year ago

You have to do 3 steps for this to get it working:

  1. Set the desired charging power set_sg_forced_charge_discharge_power
  2. Select Forced charge from set_sg_battery_forced_charge_discharge_cmd
  3. Select Forced mode from set_sg_ems_mode

And then, after a short while, the inverter should begin charging the battery. Could take a little while before it starts.

This works perfectly for me (Home Assistant 2023.1.7; inverter integration last update: 2023-01-20; SH10RT-v112). I like your work a lot and I enjoy reading your modbus_sungrow.yaml ;) Thanks for that!

Although I like to change the values of set_sg_ems_mode and set_sg_battery_forced_charge_discharge_cmd manually in the GUI I would love an automation for that action.

My first usecase for that action will be the 'sensor.electricity_price_home' of my tibber integration (dynamic electricity tarif) as a trigger to charge my battery (if price <x € then charge) . Later then there should be conditions like pv-production forecast because usually the electricity price is cheaper at night than at day. But in the long run I don't want to force charging if the pv-production will be more than my consumption incl. saved electricity.

Can you help me with that? How should I define the action in that automation?

mkaiser commented 1 year ago

hi GrandAmmor,

this would be a separate issue here... sorry, but I am loosing the overview of open, closable issues and discussion.

You can use the automations at the end of the yaml file as a blueprint. If you are not familiar with YAML, you can also use the settings --> automation GUI.

As Action, you need to select "Call a service", then "Modbus:Write register" and use the values from the yaml.

If you need more specific help, please open a separate issue. There are some friendly guys around here who are glad to help

GrandAmmor commented 1 year ago

Thx for your fast reply! I'll keep on trying, but have to open a separate issue also, I guess ;)

dylan09 commented 1 year ago

Load on inverter is > 5.000 W. Nearly exactly 1.000 W were taken from the battery and the rest is coming from grid. But I will double check again if my battery is charged again. Actually no sun here in germany.

Found the reason for this behavior. While I am experimenting with my inverter and iSolarCloud a played with Active Power Limit. Have set it to a value of 10%. And it seems, this is also respected when discharging the battery 😅. So has nothing to do with the modus register settings.