springfall2008 / batpred

Home battery prediction and charging automation for Home Assistant, supporting many inverter types
https://springfall2008.github.io/batpred/
129 stars 44 forks source link

Huawei Luna2000 charge discharge loop #1352

Open JohanAlvedal opened 3 months ago

JohanAlvedal commented 3 months ago

Describe the bug When is charging to a specified % and the value Battery discharge = number.battery_maximum_discharging_power is set to 4000W So the battery charges as it should, but as soon as it reaches the specified %, it starts to discharge again if the value Battery discharge = number.battery_maximum_discharging_power is set to 4000W. Huawei Luna200 otherwise it will keep charging and then discharge charge in an endless loop. This is not noticeable as long as the sun is generating, but it is when it is dark outside.

Expected behavior When the battery should charge to a specified %, it should set Battery discharge = number.battery_maximum_discharging_power must be set to 0
Only when the battery is expected to discharge using force or the house's consumption, should it be 4000W in Batteries Maximum discharging power = number.battery_maximum_discharging_power

Predbat version 8.3.2

Environment details

Screenshots Here you can clearly see how it looked last night when it charged to 100% and then discharged until predbat wanted to charge it again pb5

Log file No problem in log.

JohanAlvedal commented 3 months ago

I'm seeing the opposite problem now with the battery draining. charge must be set to the value 0

It should be quite easy to fix Status:

number.battery_maximum_discharging_power

image
JohanAlvedal commented 3 months ago

Today

Inkedpb6_LI

springfall2008 commented 3 months ago

This is different from other inverters, I'll try to add an option for this behaviour soon

springfall2008 commented 3 months ago

I've added a change to 'main' to enable a new inverter option called 'charge_discharge_with_rate' which when set to True should do what you want.

e.g:

inverter: charge_discharge_with_rate: True

Can you please give it a try, I don't want to change the default for HU until it works?

JohanAlvedal commented 3 months ago

Ok trying now but something is wrong. The value changes all the time

IMG_0356 IMG_0355

JohanAlvedal commented 3 months ago

Now that it went to idle it is correct. No i was wrong se pic 2 still force charge but status idle

IMG_0357

IMG_0358

JohanAlvedal commented 3 months ago

https://justpaste.it/dzonh

springfall2008 commented 3 months ago

What is in your apps.yaml?

JohanAlvedal commented 3 months ago

https://justpaste.it/e6lpd

springfall2008 commented 3 months ago

I don't really understand the charging power thing, can you show these two on the chart?

- number.battery_maximum_charging_power
- number.battery_maximum_discharging_power
JohanAlvedal commented 3 months ago

I don't really understand the charging power thing, can you show these two on the chart?

- number.battery_maximum_charging_power
- number.battery_maximum_discharging_power

and I don't understand what you mean by chart? Maybe you and I would have a video meeting on messenger so you can see how my inverter behaves.

JohanAlvedal commented 3 months ago

Ok, I think I know how they work. When the inverter has no "forcible charge" or "forcible discharge," we shall call it "idle." If there is excess power from the solar cells and number.battery_maximum_charging_power has the value 0, it exports everything. But if it has a positive value, say 2000W, then it charges the battery with 2000W, and the rest, if any, is exported.

If number.battery_maximum_discharging_power has the value 0 and the solar cells produce 0W while the house has a power demand, then the power is taken from the grid.

But if number.battery_maximum_discharging_power has a value of 2000W, then power is taken from the battery up to a maximum of 2000W, with the remainder taken from the grid. This means that as long as you do not run any force action, you can control the charging with number.battery_maximum_charging_power if there is power from the solar cells.

So, if you run a "forcible charge" of 2500W to 80% or for 60 minutes, then number.battery_maximum_charging_power must also be changed to that value (2500W); otherwise, nothing happens. Even if you stop the action, it continues to charge or discharge if the solar cells have excess power. At the same time, the equivalent setting is number.battery_maximum_discharging_power when discharging the battery.

So then maybe you understand the consequence of - number.battery maximum charging power has a value (say 2000W) at night or when it has forcible charge and it reaches its target of say 80% then it discharges the battery immediately.

So, if you want to charge the battery with excess power from the sun during the day, then number.battery_maximum_charging_power should have a value (e.g., 2500W or whatever it should be). If you don't want that and prefer to export all the excess, then number.battery_maximum_charging_power should be set to 0. Now, if the battery is full, all excess power goes to the grid.

The same logic applies at night or when the solar cells are not producing any power. If you want to cover the house's needs, you have to set number.battery_maximum_discharging_power to, say, 2500W. This will discharge the battery to meet the house's power needs.

With forcible charge or discharge, you force the battery to charge or discharge itself with the specified power in number.battery_maximum_charging_power or number.battery_maximum_discharging_power, even if the solar cells are delivering power or not.

JohanAlvedal commented 3 months ago

FYI, I have reverted to V8.3.2 and disabled services. Then, I created an automation that controls my inverter based on the Predbat status and the Predbat charge/discharge sensors. It works, but it has become quite complex. Before this, it wasn’t possible to run it properly without spamming my inverter.

I have also created package files for my Huawei inverter to get the right sensors, even one more for Predbat, along with a complete automation to enable car charging. I will also add the entire automation to control the battery, etc., once I’ve debugged it for a few days. So, a request could be to have an inverter template that doesn’t require direct control but is instead managed via external automations.