So, as promised, I thought I would come back, to report how my project is going. Hopefully, it will help others to achieve the same thing, in the future, by bringing the various sources of help I have used. I make no apologies for this being a bit of a noob guide. It has been quite a lot of work to understand how to do all these things, so hopefully an explanation in layman’s terms is useful for others.
Objective: Install HA on a Raspberry Pi 4, and use it to control my solar, battery and Air Source Heat Pump (ASHP isn’t installed yet), to maximise the financial benefit of the system in various scenarios in particular:
- Taking advantage of charging battery when Intelligent Octopus (EV charging) is providing 7.5 p/kWh off-peak rates (which can happen randomly during the day, whenever Octopus has excess energy)
- Pushing excess battery charge to the grid to benefit the grid daytime usage
- Saving and pushing battery to the grid during Octopus Energy “Saving Sessions”, to take advantage of £2 to £4 per kWh bonus payments.
Why? - I think I can make an extra £600 to £1000 per year, by simply using my battery to shift energy to and from the grid in off-peak and on-peak times, whilst helping the grid manage energy better.
Currently, I have managed to receive data from all the required systems and servers, and use that to make decisions as to which mode to put the SUN2000 inverter in. However, I have yet to connect the output of the automations to actually switch the SUN2000 inverter mode, as I want to spend a few days, checking that it makes the right decisions, before I make the system fully live.
Connecting the RPi to the SUN2000 inverter
The Huawai SUN2000 has 2 WiFi adaptors inside it. One connects to your home WiFi network to gain access to the internet for the Huawai mobile phone control app. The other WiFi connector is for connecting to the maintenance app, used by the installer. It is this second WiFi connector, which needs to be connected to the RPi, in order to connect it to HA.
This second (maintenance) WiFi, has its own DHCP server, and only allows one connection, or 192.168.200.2 (with 192.168.200.1 being the IP of the SUN2000 inverter maintenance interface). There are a few options, such as creating a bridge between the two subnets of your home WiFi, and the inverter maintenance WiFi, but by far the simplest option (which I used), was to connect the RPi to my main LAN using an ethernet card, and then connect the WiFi interface on the RPi, to the SUN2000 maintenance WiFi (so the RPi is connected to two different networks.
I did this, by following the instructions in this video - it was super easy, once I had found it: https://www.youtube.com/watch?v=6VTQXk01cWY
The above video requires the Integration found here to be installed via HACS, before connecting to the SUN2000 WiFi (GitHub - wlcrs/huawei_solar: Home Assistant integration for Huawei Solar inverters via Modbus) - Thanks to @wlcrs for this amazing Integration!
@luciandf asked me on a different thread, whether it was possible to both monitor the SUN2000 parameters AND control the inverter. From what I have discovered, it is possible to fully control the inverter, but you need to select “Elevated Permissions” (see 1m37sec in the video), which will then require you to enter the Installer’s password for the SUN2000 inverter.
Note: If you don’t have the installer’s password, then it is possible to reset the passwords really easily, and instructions are on the Huawai website.
Getting Intelligent Octopus charging slot data from Octopus energy
It would of course, be completely acceptable to just charge the battery between 23:30 and 05:30, and all work work fine, but there are times when Octopus gives 7.5 p/kWh EV rates for the whole house, in the middle of the day. So, I was keen to be able to see these occasions, and give the house battery a little burst of charge, (and take from the grid), when this happens.
In order to do this, I used this Integration from @megakid: GitHub - megakid/ha_octopus_intelligent. This integration connects to your Octopus Energy account, and provides various parameters for controlling and monitoring the status of your account.
By using the binary_sensor.octopus_intelligent_slot parameter, I was able to use this to change the mode of the inverter, from “releasing to the house” to “charging”. Super simple, and super effective.
Pushing energy to the grid during “Saving Sessions”
A bit of background… The grid gives bonus payments for how much energy you save during their “Saving Sessions”, to help them manage the grid. They measure the saving, by calculating the average amount of energy you use during the day (at the time of the saving session), and comparing it to the amount of energy you save (or even better, feed-in to the grid), during a saving session. So, if you have an ASHP and normally cook at 18:00hrs (which is usually when the saving sessions occur on a very cold day), your savings will be the difference between a normal day (maybe +6 kWh used from cooking, lighting, heating, etc), and the saving session (maybe -4.5 kWh, if you load-shed and push the battery back to the grid). This is a difference of >10 kWh, which, on a day when they are unusually low on power, could result in 1.5 hours at that power, at £4 per unit, which is £60!!! (half my months electricity costs)!
@kamilb has a great thread here, where he talks through his version of the same idea: Automated Octopus Saving Sessions with Solax X1 Hybrid G4 - #6 by robbo100, which is where I found the Blueprint for automatically joining the Octopus Energy Saving Sessions: Services - Home Assistant Octopus Energy by @BottlecapDave.
I am yet to fully test this at the moment, because we haven’t had a Saving Session for a while, and the parameters all show as null until an event is “announced”, but I am fairly sure I have been able to use one of the parameter to trigger discharging the battery to the grid (binary_sensor.octopus_energy_[Octopus_ID]_octoplus_saving_sessions)
This bit of automation, does the following:
- I have a switch that enables me to pause the battery discharge between 16:30 and 18:30 (the most likely time for a saving event). On most days my battery won’t last this far into the day anyway). This switch will be turned off during the summer, when there are no saving events, so that I maximise the use of solar.
- 3 hours before an saving event, I stop the battery discharge, and if it is below 55%, I charge it back up to 55%, whilst there isn’t a grid shortage
- When the saving session starts, I discharge the battery into the grid at max rate possible (and turn off the ASHP etc).
- At the end of the event, I return the system to normal mode (discharging to the house), or turning it off (if it is at or below 10% SOC.
Other saving opportunities
Since I charge the battery at 7.5 p/kWh, and I get paid 15 kWh for pushing power to the grid, there are small amounts of money to be made (and benefit to the grid) for pushing any excess battery, back to the grid in the early evening (between 19:00 at 22:00).
Throughout the day, I track the average power used by the house, and then extrapolate that to the end of the day by means of a “Battery State of Charge needed to make it to the end of the day” After 19:00 hrs, if this parameter is above the actual battery state of charge, I push energy to the grid, and once below, I stop (which a bit of time-based hysteresis, to avoid constant mode flip-flopping).
This might seem really tiny, but on a summer’s day, this could be an extra £1.50 of battery, which could add up to an extra £300 per year.
Thoughts on the above
I will look to connect this all up to actively control the inverter in the next week or two, once I am happy that it is all behaving.
I am in two minds about whether this is “gamifying” energy savings, but using the battery to manage demand periods (if implemented by lots of people), could make a dramatic impact on grid energy management, and help to turn off a number of coal powered generators, so it feels generally a good thing. It is down to the grid and energy companies to direct us as to the most effective timings of release, by financial incentivisation (e.g. peak vs off-peak, and energy saving sessions). Hopefully these invcentives will adapt as the national home battery storage changes.
Other learn points from a noob
If you have got this far, then well done, and thanks for reading.
My main pointers for anyone starting out as a noob HA user, are:
- “Helpers” are your friend. “Templates” continually update as parameters and are really useful to use as triggers. It took me a while to work out how to create Templates, but they have been a massive help!
- Internet parameters can be flakey. For various (not yet known) reasons, my Octopus Energy account parameters seem to occasionally switch to “Unknown”. In order to fix this and stop unexpected mode triggering, I have created some automations which “smooth” the values, to ignore when the parameters go to an unknown state. This made a massive difference
- Start simple, and don’t make your system live, until you are confident that they work. Be aware that “closing the loop” around your automations may create unexpected results, so keep an eye on it (I am yet to hit this phase of testing, but am looking forwards to it).
- I found setting up power-flow-cards super confusing, because some of my energy parameters weren’t in the correct units (and so weren’t selectable in the power cards), and some just didn’t exist. For example, I needed to create a Helper to calculate “Power used by the house” (from Inverter Power, and Grid Power). It took me a while to work this out, and create helpers to convert units etc.
- Enjoy the process of learning as you go. For someone like me, who only knows some basic coding (and never practice the skill), it isn’t easy to understand some of the information. But you will get there with perseverance.
Thanks for reading!