-
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
What would it take to include Sofar inverters? #395
Comments
Hi, The cleanest way to add support would be to control the inverter via Home Assistant entities as is being supported for other inverters. If you have the list of entities with their contents then it might not be too hard to map. Basically you need information about the system, ideally can be read via HA but could be hard-wired:
Then you need to be able to read directly the following:
Then you need a way to:
|
Battery size - hard wired, as only the SOC is read The inverter has a certain level of battery control in it, with a max discharge of 15% and a max charge of 100% SOC: sensor.sofar_inverter_battery_SOC Grid power: sensor.sofar_grid_power (W) Exported energy: sensor.sofar_energy_today_exported (kWh) Force charge: switch.sofar_charge_mode_3000 (or 1000, 1500, 2000, 2500 etc..) |
I've managed to get PredBat reading my data and creating a valid plan. In the instructions, there are supposed binary_sensor.predbat_charging and binary_sensor.predbat_discharging that I thought I could create a trigger off to change the state of my inverter - however, these don't seem to exist in my sensors. How can I identify if my inverter should be changing between charging, discharging and auto? Ideally, I'd use these sensors to start a charge until the sensor switches off again - i.e. if the plan says I need to add 0.5kwh to the battery, the sensor will switch off when I get there rather than at the end of the slot. Is this how they should work? I'm also not sure what behaviour I'm meant to provide to my inverter for a FreezeChrg and HoldChrg period? |
Can you share your apps.yaml so far so it can be added? I don't think you want to automate based on the sensors, we would want Predbat to trigger the charge or discharge itself. Can you maybe share an automation that starts/stops charging and discharging and then that can be used to add to Predbat code? |
There are four parts to this:
Example commands to start / stop charging are:
|
I'll try to have a go at supporting this soon, I don't think mqtt is hard to add |
I've committed some changes to : https://github.com/springfall2008/batpred/tree/Sofar - The python updated and the template Predbat config file (https://github.com/springfall2008/batpred/blob/Sofar/templates/sofar.yaml) which you will need take my updates on. Can you give it a try, I'll add in your other files once something is working? |
I've done a (very) manual install of branch - not sure if I've done it right, but I overwrote the predbat.py code and the apps.yaml. I'm seeing this in the logs: I'm also seeing a lot of warnings along the lines of: |
For the first one I think 'battery_max_rate: 3000' needs adding to apps.yaml. For the exception, can you go to 'settings, system, logs, appdaemon' and paste in the stack trace? |
These are good, they happen when Predbat creates sensors for the first time |
|
Thanks, I updated the YAML template and predbat.py on the branch, effectively it was trying to use the number as an entity which didn't work. |
and from the appdaemon log:
|
I've just pushed a fix for that, please update and re-try |
I've been running it this evening. A couple of issues still: The MQTT Sofar2mqtt/set/charge looks like at least an order of magnitude out - "0.05". The value needed is the charge rate in W, so 3000 = 3kW.
|
Okay, I've pushed another fix to predbat.py Sorry this is so slow, I can't test it myself. |
Only just been able to test this today, (and didn't want to disturb things during powerup and saver session)
|
The last of those error messages was when predbat sent a mobile notification that it was joining the saving session. Bug on my part, it's fixed in the latest release. Only occurs at the moment of joining the saving session, it joins ok but then crashes when sending the mobile alert. |
* Improvements * Added load_scaling10 to allow the worst case scenario to include higher load - default 1.1 * Fix charge freeze to disable the charge window when holding using reserve * Put some more options into expert mode * Try to stop charge window from being disabled when it doesn't need to be * Update customisation.md * Update faq.md * Second attempt to fix force discharge time to 0 #462 * Sofar inverter fix - mqtt scale issue with charge rate #395 * [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>
Can you try the latest from 'main' please, these things have been fixed |
This latest version seems to have regressed to an error that was fixed yesterday. Also, the MQTT message for set charge is still coming through as 0.05.
|
What version is being reported in the log or in the version sensor? I did just push another fix to main related to this crash so you might want to update |
THIS_VERSION = "v7.14.12" |
v7.14.13 is on main right now, so maybe try that and see if it changes anything. I'll release it once its stable. |
I've not seen it charge yet, but seeing the following:
|
How can the reserve be set by Predbat, what's the MQTT command for that? |
I don't believe it can - we have to monitor it and set the inverter to standby ("Sofar2mqtt/set/standby") when we hit the lower reserve, or auto when hit the upper reserve. |
I've added a fix on main for now which disables the set_reserve/set_reserve_hold if the inverter doesn't have a reserve. We could emulate as a next step. |
Thanks - I'm still seeing the following:
|
|
Great - this all seems to work!
|
Please review the documentation here and send me any updates: https://github.com/springfall2008/batpred/blob/sofar/docs/other-inverters.md |
Thanks - documentation looks like it covers it. The only tweaks I'd make are:
Thanks again for your help in getting this to work! |
* load_inday_adjustment typo * added min battery level sensor to Sofar inverters #395 * correct formatting issue on bullets * Added battery_scaling advice for 80% DoD batteries and All in One * Explain bold import/export rates on predbat plan * New FAQ for inverter in calibration mode * Detail of entities to uncomment out for battery discharge curve creation * Add RobinC's tips from #693 * rates_export_override example from #693 * Expanded freeze charging and freeze discharging #744 * Expanded manual_idle mode explanation (aka Eco mode) #729. Added that changes to the selectors are async and Predbat still has to update the plan * Car charging instructions and sample predbat-led charging automation per GE forum discussion * Export rate overrides to shift when exporting is done #693 * Custom card install instructions * best_soc_keep explanation #755 * Add manual card for Predbat plan card * Adding custom card config * Link to Apex Charts YT video * Link to YT video and importance of creating charge curve for low power mode * Corrected missing editor text * Further highlight turning Enforce Basepath OFF * Added links for useful HA introduction videos * Added GivTCP self-run frequency recommendation & time inconsistency FAQ * Expanded car_charging_hold explanation #766 * forecast_hours and forecast_plan_hours for #768 * [pre-commit.ci lite] apply automatic fixes --------- Co-authored-by: Trefor Southwell <48591903+springfall2008@users.noreply.github.com> Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
I've just upgraded my inverter to Sofar HYD, and keen to have BatPred running for it. What would it take to have BatPred run this inverter as well?
To control the inverter, the best way seems to be through RS485 via Sofar2MQTT.
This gives a number of MQTT topic subsets that cover SOC, grid power, inverter power, house load etc...., and MQTT publish topics to force charge or discharge the battery at variable rates. This is done through a mode called "Passive Mode" on the inverter, which isn't by time of day but is fully controlled by RS485 commands.
I saw the previous post about getting Solax inverters included, and the list of entities needed. Before I complete something similar, question is whether its more use to you in the MQTT topic format or not. Alternatively, as I can name the entities anything I want, would it would be simpler to have a specification that I can name my entities against and this become a more versatile solution?
For example:
Charging: (variable rate)
Discharging, as above with Sofar2mqtt/set/discharge
Auto, again with Sofar2mqtt/set/auto and payload of "true"
SOC:
The text was updated successfully, but these errors were encountered: