BYD Battery Control - Charge/Discharge

I would really like to be able to control my BYD battery to charge/discharge based on either rules or a switch (example charge to 20% over night, if predicted PV output below x% then charge to y% etc). Presently there is no way to control the BYD battery. Hopefully someone much smarter than me can come up with something.

Hi,
I am struggling with the same issue in openHAB. We have a Fronius GEN24 inverter, a Smartmeter, 6,4kWp panels, Ohmpilot for the hot water boiler, Wattpilot for the EV and a 10kW BYD battery. The inverter optimizes everything fine exept the charging of the battery with cheap night time electricity when next day PV supply is limited. For now my wife optimizes manually the battery charging settings every evening.

As we starting from this month are using SPOT market electricity I have used openHAB to optimize all our electricity usage to the cheap hours.

So far I have found out that the BYD battery must be controlled trough the GEN24 inverter by reading and writing to 7 different Modbus addresses. I have started to write and test some rules and scripts. Here in Finland I can get the houely solar forecast for the next day from the Finnish Meteorological Institutes Harmonie database.

The steps I am following to build the rules and scripts to optimize the BYD battery charging are basically the following,

  1. Fetch the solar radiation estimates per hour from FMI and write them to Influx database
  2. Transform the solar radiation estimate to a daily estimate for our system
  3. Calculate needed SOC at sunrise based on radiation estimate and average consumption per hour during the day
  4. Calculate needed charging hours
  5. Search cheapest night hours using already fetched Entso-e SPOT price values from Influx database
  6. Set charging control hours in the Influx database
  7. Every hour run a rule that checks from the Influx database if charging should be done and stop when calculated SOC is reached.

I am in the very beginning with my coding for this BYD charging control and As I said I am doing this in openHAB and I don’t know how much it differs from Home-Assistant. But changing ideas usually benefits us all.

Here i a screenshot of the BYD Modbus addresses on GEN24

1 Like

I have basically the same problem here. Currently I’m searching for exiting projects, before starting to code that by my own.
What I found is GitHub - davidusb-geek/emhass: emhass: Energy Management for Home Assistant, is a Python module designed to optimize your home energy interfacing with Home Assistant.. It’s a quite young project with full HASS integration. Sounds promising to me but I’m not sure if there are all features implemented. But it’s maybe a good start. I did not have time to test it until now. Maybe it helps you.

1 Like

ok just recognize that you are more looking to solve the special problem of controlling charging and discharging of the battery. In some inverters are special modes to trade energy. E.g. Goodwe calls that eco mode. Here you can control to charge or discharge you battery to buy or sell energy. Switching the modes via Home Assistant with adjusted SOCs will be the way I gonna solve that for my setup.
I don’t know if your inverter has similar options.

Hey great project,
I want to stop discharging the byd by loading my car with cheap electricity from grid over night…
I´m searching for those Adresses, great! But in wich way you can manipulate the connection?
Normaly the inverter is in connection with the byd… how do you connect your modbus wires?
By the way, when you change, for example the OutWRate to zero, why doesn´t the inverter switch it back, how do you handle this?
Which byd do you use?

any updates - looking for that too :confused:

Hi,

I’m just about to change to spot price, and I want to automatically charge the battery on the cheapest hours. Like when Nordpool price is below this, then charge.

Does anyone know a good starting point?

So far I’ve set a manual schelude. Cars are charging between 02-05.

Though this doesn’t feel optimal, and could lead to the battery charging on high spot prices. I will also put wear on the battery and shorten lifespan.

Maybe it would be better to just:

  1. Disallow disharge when cars are charging
  2. Disallow charging at known peaks (5-9 and 16-20)

1 Like

@ruxu Reading this again, did you finish your project? What did it end up with?

Preferably I would like to talk directly to Modbus and make changes instead of using some kind of API. Actually you can’t even write to the Fronius API with the HAOS official imtegration for Fronius… It seems like that integration main use of for the Energy dashboard. Well…

I never touched the Modbus subject before, so maybe you have some configs to share now when it’s been a while and your project evolved…?

I read somewhere that for battery charging during night to be profitable, the difference in price must be at least 1 SEK (e.g. cost is 100 cent when charging during night, and it would cost more than 200 cent to draw from grid the next day), and that’s not usually the case, especially if you include fees - which in turn means that it would cost more to cycle the battery during night, than to just let it sit and do nothing. So an optimization that would automatically charge the battery when that actually happens, and the Solar PV forecast is bad the next day would be perfect.

Btw, my new strategy for the battery is now this: