Dusting off the cobwebs after 8 years. Oops.
I’ve had a SolarEdge PV and battery system for a few months now. It generates, stores and discharges electricity just fine but the SolarEdge software offering around controlling the battery is very limited; it’s supposed to be getting some updates but they are slow to arrive and the beta’s haven’t been smooth. So I’ve taken control myself though Home Assistant and the modbus integration.
Charge % limit
The main feature I have implemented so far is being able to control how full the battery charges overnight during our off-peak tariff window.
Input Helpers
I needed two Input Number helpers to store my desired and default battery percentage. These are simple to set up; minimum value 0, maximum 100, step size 1, unit of measurement %, done.
Desired battery percentage is used as the % the battery should charge to each night.
Default battery percentage is a fallback if I don’t set a desired percentage each night (see notification setup below), this will be adjusted throughout the year as the weather and amount of solar generation changes.
Nightly Notification
I decided I would set up a nightly actionable notification at 10pm to ask what % I wanted to charge the battery to over night.
The notification contains the predicted PV generation as well as the time of peak PV power for tomorrow, from the forecast.solar integration. This was intended to allow me to pick a suitable amount of charge, but the forecast isn’t proving very accurate so far, more tweaking required. Instead, I just check the weather forecast on my phone.
The notification also displays the default %, from the input helper and has 3 actions; set to 90%, set to 80% and Custom, which allows me to reply with any number (well any text, there isn’t any validation on that).
When I respond to the notification the automation sets the desired battery % input number helper to the correct value, if I don’t reply to the notification within an hour, the default % is used instead.
The full YAML for this automation is on my github.
Off-Peak Charging Automation
The main portion of the charge limit % feature is achieved through another automation.
Triggers
The automation triggers whenever the state of charge (%) of my battery changes.
Conditions
- Check the battery state of charge (%) is above the desired battery percentage value from the input helper
- The current time is within my off-peak window (0230-0630)
- The battery is currently in Time Of Use (TOU) mode – TOU is the default mode I use, I have my 0230-0630 charging schedule setup by my installer.
Actions
- Set the battery mode to Disabled
- Wait until the off-peak window ends – 0630
- Set the battery mode back to Time Of Use
You can see the full YAML on my github.
A Hiccup
The above automations had worked well for several weeks without issue, then one morning I woke up to find my battery was disabled and I had been drawing electricity from the grid at peak rate, only a small amount but it was still annoying.
On inspection, it looked like my automation had run as intended, but 1 minute after the battery had been re-enabled at 0630, it changed back to Disabled
with no explanation as to why.
This was unacceptable to me, I needed to fix it.


A More Robust Automation
In order to solve my problem, I decided I needed another automation that would continually ensure that my battery didn’t end up disabled unintentionally again.
Desired Battery Mode
To achieve this I needed to know my desired battery mode, this is easy enough with another helper; an input select with the same options as the actual selector on for the battery mode.
The next step was to tweak my off-peak charging automation to change the desired battery mode rather than interacting with the battery mode directly, that was simple, see the changes on github.
Battery Mode Sync
Another automation, which triggers any time the desired battery mode changes and then sets the actual battery mode to match was created.
Disabled Fixer
A final automation was created for the scenario where the battery mode changes to Disabled
unintentionally
Triggers
The automation triggers whenever the battery mode changes to Disabled
Conditions
- Confirm desired battery mode is NOT
Disabled
Actions
- Send an actionable notification with a “Fix” and “Cancel” action
- If fix or no response within 2 mins; Set the battery back to TOU mode, wait 30s, repeat until actually battery mode is TOU
- If cancel do nothing – In case it was intentional, just not controlled through Home Assistant
This should make the whole setup a bit more resilient.
You can see the full YAML on my github.
Future Plans
I have a few ideas of more things I want to try and do with the Home Assistant integration to provide features that SolarEdge aren’t providing themselves.
Predictive Overnight Charge %
As alluded to earlier, there are integrations for Home Assistant that will predict PV generation for tomorrow. Getting these sufficiently accurate enough for use would mean that I am less reliant on the nightly notification and me responding. The disparity between the off-peak import price I pay (7.5p/kWh), the export price I get (4.1p/kWh) and my peak import rate (40p/kWh) means that the price for not charging enough overnight is significantly larger than the potential savings to be made by not charging to 100% evernight so I need to err on the side of caution.
Battery Priority
Having a DC-coupled battery and an EV charger from a different manufacturer (MyEnergi Zappi) means that they don’t function with much cohesion. Due to the way the our PV is situated, we can’t generate enough excess to charge the EV (purely from Solar, 1.4kW minimum) after about 3pm. However we are still usually generating excess at this time. I would like to be able to put this into my battery rather than exporting it, that requires there to be space in the battery. If I can stop the battery from consuming all the excess earlier in the day and send that to the EV, then I should have some capacity left after 3pm to fill up. Investigations on how to do achieve this are on-going.
Before you go
Are you in the UK? Do you get your electricity and gas from Octopus Energy? If not, you should. They offer some of the most attractive tariffs to people with solar, batteries, EVs etc.
If you use this link to sign-up: https://share.octopus.energy/wind-panda-494 , you’ll get £50 and I’ll get £50.