-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please add support for Huawei inverters. #684
Comments
Can you attempt to take a sample configuration from 'templates' and try it with your sensors? I suspect you will need my help to control charging and discharging, its not obvious to me how these are triggered |
Taken from the github link above: forcible_charge: Forcible Charge This allows you to forcibly charge your battery for a given duration or to a given SoC level of your battery. While a forcible charge is active, it will direct all power received from the solar panels to your battery instead of covering your home electricity usage. If the "Charge from grid" toggle is set, it will also draw power from the grid until the given charge power level is reached. Forcible Discharge This allows you to forcibly discharge your battery for a given duration or to a given SoC level of your battery. This forces the inverter to inject more power to the AC-side than your home electricity usage, which will consequently be pushed onto the grid. Stop Forcible charge or discharge Calling this service will cancel any running forcible charge of forcible discharge command. I have a reasonably functioning config. there will be no direct errors in the log as far as I can see. then of course it could be the wrong sensors I have, etc. |
I've made some changes on a branch:
This has a new inverter type select HU and the services for charge/discharge defined
Added code for the new inverter type and using the services. Please give this a try, however for it to work you need to fix your load sensor otherwise its not going to do anything useful |
Thank you very much, I will double check and get back to you. |
`2024-02-05 21:50:03.612180 INFO pred_bat: Inverter 0 Stop charge via Service Server got itself in trouble Server got itself in trouble |
I must have the service name wrong, you can change it in apps.yaml if you can figure out the correct name |
Okay I think I might know the issue, the service needs a device_id to be set. Can you:
|
Did you remove "HU" from the latest predbat.py ? I added it and then the errors in the log disappeared, kinda.
|
Sorry I gave you the wrong link you need to take predbat from the Huawei branch and not |
@JohanAlvedal if you don't have a native 'home load' sensor easily available in HA, there's the code for custom template to calculate home load from import, export, solar and battery data in the HA docs you could utilise |
Made one now so I have to wait for some history. |
@JohanAlvedal did you try the correct code here? with device_id set https://github.com/springfall2008/batpred/blob/huawei/apps/predbat/predbat.py |
Result of newest prebat.py |
You would need to move away from monitor mode and into control charge to see if it does anything |
|
Hmm, odd error - can you go to 'settings, system, logfiles' and select appdeamon (or adddeamon-predbat) and then check for the full error at the end of this log and paste it here please? |
File "/usr/lib/python3.11/concurrent/futures/_base.py", line 456, in result 2024-02-06 21:35:03.822087 WARNING pred_bat: ------------------------------------------------------------ 2024-02-06 21:40:03.726209 WARNING pred_bat: ------------------------------------------------------------ 2024-02-06 21:45:03.765711 WARNING pred_bat: ------------------------------------------------------------ |
What do you have in apps.yaml for 'charge_start_service' ? |
charge_start_service: |
No sorry in apps.yaml it should say: charge_start_service: service: huawei_solar/forcible_charge_soc And you need to replace the XXXX with your device ID as per the above template |
https://pastebin.pl/view/9172ef45 apps.yaml code #Services to charge/discharge charge_stop_service: discharge_start_service: discharge_stop_service: #Predbat, HA log ` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-02-06 22:12:55.709484 WARNING pred_bat: ------------------------------------------------------------ 2024-02-06 22:13:30.823890 WARNING pred_bat: ------------------------------------------------------------ 2024-02-06 22:15:03.820551 WARNING pred_bat: ------------------------------------------------------------` |
Sorry I'm maybe not being specific, the apps.yaml should say: #Services to charge/discharge charge_start_service: huawei_solar/forcible_charge_soc |
predbat.log Addon log. Add-on: appdaemon-predbat
|
Can you actually try trigger a force charge and a force discharge to a target SOC in Developer Tools/Services and then send me the YAML for both of them (if they actually work)? |
I think I might have to add 'power', if so what value? |
Charge night time 4500w |
Do the above all work okay when you hit 'call service'? It seems that we need to add power, what's the maximum power? |
Updated to include power setting here: https://raw.githubusercontent.com/springfall2008/batpred/huawei/apps/predbat/predbat.py |
Did you try changing your reserve min to 12% as above and re-test? = yes, I run now and have to wait for the result. but have been away for a couple of days when I ran a different flow then. No, you didn't miss anything. What is expected to happen when it goes to idle? Should it continue to drain the battery? Because then my question is if there is any difference between discharege and idle? I am a little unsure if my inverter's Maximize self consumption mode is the same as what you call eco mode. It discharges all the time as long as there is some % in the battery, |
Ah okay there is a terminology difference here, so 'idle' in Predbat means ECO Mode in GE inverter which is when the battery covers the house load. This is different from what it calls Discharge which is when you export to the grid at maximum rate. |
the problem right now is that if it should charge to 33% as an example. Then it charges to 33%, stops charging, then automatically starts discharging for a while and then charges to 33% again, etc., etc. the only way to make the battery stop discharging is to set number.battery_maximum_discharging_power to 0. |
That's progress, if its working then as the next step I can add this to the code :) Did you have to change the apps.yaml any further? |
Same thing with hold charge, there are two options as far as I can see. Either set (number.battery_maximum_discharging_power) to 0w or change workmode to (select.battery_working_mode) to time_of_use_luna2000 and then go to maximize_self_consumption to discharge the battery. my apps.yaml |
Or wait it's wrong with hold mode if you set it to always load in TOU (time_of_use_luna2000) then it's best to stay in Work mode: maximize_self_consumption and set number.battery_maximum_discharging_power to 0 W Then it should stay there |
I think your apps.yaml has an error, shouldn't charge/discharge rate be set as follows: charge_rate: Have you tried turning off 'set_charge_freeze'? The reason it doesn't work is you have the reserve hard wired at 12 rather than set in a way that Predbat can change it. Normally in charge freeze the reserve is set to the current battery level to avoid the discharging, mosty as setting discharge power to 0 with GE inverters doesn't totally prevent discharge. Can you try with set_charge_freeze off and also correct the above? Then please share a logfile? |
Aha let me change and restart. set_charge_freeze was off, but Set Discharge Freeze Only is on |
So far looks like, see how it goes... |
Hello |
Okay thanks for testing, I'll make a change to use discharging power as a next step. |
Can you try this version which should disable the discharge during charge periods? https://github.com/springfall2008/batpred/blob/huawei/apps/predbat/predbat.py |
Good, I'll try and get back to you tomorrow |
So I thin what's happening is your inverter turns off charging once the target is reached rather than holding it there. I've tried to make another update to the same file to turn off discharging while the charge happens and not just when it finishes: https://github.com/springfall2008/batpred/blob/huawei/apps/predbat/predbat.py Can you please try this one? |
Exactly like that but with the result that it immediately discharges. Ok I'll try again with the new one |
Now it looks like it's working, I'll leave it for a few days and get back to you. One thing that I react to is all the notifications, I have inverter notify on and had over 50 notifications since I went to bed last night. |
That's good news. I'd certainly turn off inverter notification once it's working |
Just saw this, though it seems to work. |
* Disable discharge during charge if inverter doesn't have a reserve hold method * Stop discharge during charge #684 * [pre-commit.ci lite] apply automatic fixes --------- Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
I think I see the issue it tried to discharge to 4% but your min reserve is 14%, maybe a bug? |
I think you need to set 'battery_min_soc' to 14 in your apps.yaml |
The sensor that controls the end of discharge is number.battery_end_of_discharge_soc |
Did you make this change? |
I had already entered it.
|
Please add support for Huawei inverters.
I use https://github.com/wlcrs/huawei_solar.
This integration exposes the information and functions made available by Huawei Solar inverters directly via one of its Modbus interfaces in Home Assistant.
And not to forget Nordpool
https://github.com/custom-components/nordpool/
example of sensors in HA
PV power W = sensor.inverter_input_power
Battery SOC = sensor.battery_state_of_capacity
Battery charge/discharge in W = sensor.battery_charge_discharge_power
Export sensor KWh = sensor.power_meter_exported (total)
Import (Grid) kWh = sensor.power_meter_consumption (total)
number.battery_maximum_charging_power
number.battery_maximum_discharging_power
select.battery_working_mode
number.battery_end_of_discharge_soc
number.battery_end_of_charge_soc
The text was updated successfully, but these errors were encountered: