Using Home Assistant to control house battery and EV battery charging with octopus intelligent go to prevent discharge of battery into the car.
Community Admin / FoxESS Elite Professional
Did I help you? Feel free to leave me a tip
Book a zoom meeting for remote consultancy or help
Switch to Octopus and earn £50
Subscribe to my YouTube channel
3 x KH Hybird Inverters (Parallel Mode)
1 x H1 Gen1 (Solar Mode)
1 x H1 Gen2 WL (Testing, Modbus and API development)
24 x HV2600 (62.4kWh)
32 x 490w across 4 arrays
2 x EV's (Tesla & Mercedes)
Heatpump & Low Carbon Housebuild
3 x KH Hybird Inverters (Parallel Mode)
1 x H1 Gen1 (Solar Mode)
1 x H1 Gen2 WL (Testing, Modbus and API development)
24 x HV2600 (62.4kWh)
32 x 490w across 4 arrays
2 x EV's (Tesla & Mercedes)
Heatpump & Low Carbon Housebuild
Thanks Will - excellent automation - solves a lot of problems!
I have an H1 inverter - so if you set the Minimum SoC it doesn't charge the battery at all (but does stop discharge) - so below is the code / automation I use to change the working mode.
Notes:
Enjoy... it may take some time to get the code working... but using ChatGPT can help a lot!
I have an H1 inverter - so if you set the Minimum SoC it doesn't charge the battery at all (but does stop discharge) - so below is the code / automation I use to change the working mode.
Notes:
- When setting up, I created a blank automation, then used the 'id' for that and replaced the generated code with that below.
- Also the notification is just so I could check it works reliably, will probably remove those after a few weeks
- Replace the XXX with your entity / meter number
- Is based on 7p / 25p import rates, at the point of creating this - can adjust according to need
- This code goes into automations.yaml file - but be careful with any edits!
Enjoy... it may take some time to get the code working... but using ChatGPT can help a lot!
Code: Select all
- id: '1738061409369'
alias: Set Inverter Mode based on electricity prices
description: ''
triggers:
- entity_id: sensor.octopus_energy_electricity_XXX_current_rate
trigger: state #this trigger happens whenever the electricity price is updated
conditions: []
actions:
- if:
- condition: template
value_template: '{{ states("sensor.octopus_energy_electricity_XXX_current_rate")
| float > 0.20 }}' #checks if the current price is >£0.20 - adjust as needed
then:
- data:
message: Trigger above 15p. Price is £{{ states("sensor.octopus_energy_electricity_XXX_current_rate")
}}
title: Rate change
action: notify.mobile_app_pixel_6 #sends notification to my phone when change has been made
- target:
entity_id: select.work_mode
data:
option: Self Use
action: select.select_option
else:
- data:
message: Trigger below 15p. Price is £{{ states("sensor.octopus_energy_electricity_XXX_current_rate")
}}
title: Rate change
action: notify.mobile_app_pixel_6
- target:
entity_id: select.work_mode
data:
option: Force Charge
action: select.select_option
mode: single
Thanks, Will, for all your videos and advice. I’ve recently joined IGO and have fallen into the battery draining scenario! I’ve been manually setting slots in mode scheduler to match the Octopus additional slots, to force charge my Fox ESS batteries, which works fine until these change 2 minutes before the schedule is due to start! I’ve ordered a Home Assistant Green tonight and will be scouring posts for details how to link to inverter and set up software using my iPad… I realise I’m a complete novice at the detailed technical stuff! If anyone has a “Set Up for Dummies Guide”, that would be very helpful! Paul
FoxESS Installation
H1-6.0-E hybrid inverter
7 x ECS4100-2 v1.13. 28.2 kWh
18 x 390w panels across 2 arrays
1 x EV
1 x Heatpump
H1-6.0-E hybrid inverter
7 x ECS4100-2 v1.13. 28.2 kWh
18 x 390w panels across 2 arrays
1 x EV
1 x Heatpump
I have recently setup HA Green, so it is still fresh in my mind, I recommend you create a post in the right section to get help.paulbw32 wrote: ↑Sun Dec 14, 2025 10:14 pm I’ve ordered a Home Assistant Green tonight and will be scouring posts for details how to link to inverter and set up software using my iPad… I realise I’m a complete novice at the detailed technical stuff! If anyone has a “Set Up for Dummies Guide”, that would be very helpful! Paul
viewforum.php?f=5
I can give you a few pointers over there Paul if you make a thread.
Hello Will,
I was going to buy the HA Green and try to use it to control my Ohme charger to charge only after 11:30pm to avoid the battery discharging but not sure if this is possible. (I am assuming that Octopus would adapt its low tariff slots to suit.)
I can see that it is possible for me to follow your idea of controlling my FoxESS battery instead, but Octopus has recently decided to have the low tariff EV charging slots independant of the low tariff house slots; as I understand it. So wouldn't that have the disadvantage, that if power was needed in the house (like the cooker), at the time of the low EV charging tariff, it might import high tariff house energy to power it?
Interested to have your thoughts on this.
John
I was going to buy the HA Green and try to use it to control my Ohme charger to charge only after 11:30pm to avoid the battery discharging but not sure if this is possible. (I am assuming that Octopus would adapt its low tariff slots to suit.)
I can see that it is possible for me to follow your idea of controlling my FoxESS battery instead, but Octopus has recently decided to have the low tariff EV charging slots independant of the low tariff house slots; as I understand it. So wouldn't that have the disadvantage, that if power was needed in the house (like the cooker), at the time of the low EV charging tariff, it might import high tariff house energy to power it?
Interested to have your thoughts on this.
John
A few things to clarify, IOG takes care of your system, if you try to take 'control' of charging, then you will likely get kicked off the tariff at some point. They are clamping down on things, just a matter of time before it happens.CrabbyHorse wrote: ↑Fri Apr 03, 2026 8:01 pm Hello Will,
I was going to buy the HA Green and try to use it to control my Ohme charger to charge only after 11:30pm to avoid the battery discharging but not sure if this is possible. (I am assuming that Octopus would adapt its low tariff slots to suit.)
I can see that it is possible for me to follow your idea of controlling my FoxESS battery instead, but Octopus has recently decided to have the low tariff EV charging slots independant of the low tariff house slots; as I understand it. So wouldn't that have the disadvantage, that if power was needed in the house (like the cooker), at the time of the low EV charging tariff, it might import high tariff house energy to power it?
Interested to have your thoughts on this.
John
With Will's solution, that I have implemented on my HA Green, it simply listens for the 'off-peak electricity' flag to be turned on, which should happen during the overnight period OR if you get a random slot assigned outside of the fixed off-peak times. It works fine with my Zappi, I do not control it at all. I am not sure what integration there is with the Ohme within the HAOS, but there could be some 'flags' there to capture when it is commanded to start.
The low power slots have always been independant of the fixed overnight slots, only real change is you are only allowed 6hrs of charging time per 24hrs (an Octopus day starts at 12pm) typically overnight is cheap power, so majority of the slots allocated are set to overnight. If the grid has surplus in the evening, and it benefits Octopus in your area, they could charge your car for 30mins or more to balance the grid.
If the car is charging via Octopus IOG, then your home (cooker/battery/whatever) will be at the cheap rate. The only exception is if you choose to 'bump' charge and then it is at peak rate.