[HA Integration] Energy Management

Post Reply
nathanmarlor
Posts: 5
Joined: Mon Oct 17, 2022 12:37 pm

I wanted to share a project I've been working on for the past couple of weeks/months 😀

Frustrated by continually needing to balance solar forecast vs. battery capacity vs. house load... I set about writing a Home Assistant integration to automate the calculations, and ensure that the batteries are charged to the perfect level using an off-peak tariff (i.e. Octopus Go) in order to maximise solar but minimise grid use.

In brief, the integration ensures that your home batteries are charged to the optimal level when the forecasted solar output drops below your daily average usage and will also ensure that, given a day where the solar forecast is greater than your daily average usage, the battery has enough charge to last until dawn.

To further ease managing the battery state, the integration includes a switch to boost (+1kW) the battery charge and a second switch to charge fully; this is useful for times when you expect a higher than average load.

More details here -> https://github.com/nathanmarlor/foxess_em

Would appreciate any feedback/feature ideas/bugs etc. 😁
User avatar
Will
Site Admin
Posts: 205
Joined: Thu Oct 13, 2022 5:56 pm

Great work, nice one!
Community Admin / FoxESS Professional

Buy me a coffee or Book a zoom meeting for remote consultancy

FoxESS Tri Inverter Installation
2 x KH Series Inverters
24 x HV2600 (62.4kWh)
32 x 490w across 4 arrays
Dual Tesla Household
Heatpump & Low Carbon Housebuild
StealthChesnut
Posts: 21
Joined: Mon Oct 17, 2022 2:31 pm

Installing this! Some of the sensors are just what I wanted for working out automatic scheduling of power consumers (e.g. immersion heater).

Does the Fox Cloud account need any special role, or is a standard user sufficient?

Also, if you're not on a cheap-rate tariff, do you know how that works? I guess you set eco start and end to 0, dawn buffer to 0? How would the day buffer work?
Creator of the HA-FoxESS-Modbus Integration for Home Assistant

6.7kW 18 panel East-West split solar array
H1-5.0 with 4x HV2600 Battery Storage
nathanmarlor
Posts: 5
Joined: Mon Oct 17, 2022 12:37 pm

:D

Fox Cloud doesn't require any special role as far as I'm aware - it's just making authenticated POST requests as you would if you were using the browser to set charge periods.

If you want to stop it automatically force charging you could set dawn/day buffers to 0 (to stop it padding the charge required), then set start/end periods to a minute apart? It'll still try to force charge at the start but there's a guard in there to stop force charging at the end to prevent overruns so it'd only run for a minute. Never been tested though, so can't guarantee it'll work exactly like that...!
nathanmarlor
Posts: 5
Joined: Mon Oct 17, 2022 12:37 pm

** FoxESS - Energy Management @ v1.1.0 **

Reworked the charging logic to charge up to the required % capacity at the start of the off-peak window then hold that charge until the end of the off-peak window. This should be a more reliable approach, and will help mitigate the random SoC drop issue until FoxESS can resolve.

https://github.com/nathanmarlor/foxess_ ... tag/v1.1.0

Thoughts/feedbacks/comments all appreciated...! :)
awignall1
Posts: 4
Joined: Sat Jul 29, 2023 10:30 pm

Hi Nathan,
Trying out your Foxess EM integration, can't seem to get it started - its accepted all Fox cloud/Solcast inputs but all the entities are 'Unknown' except the solcast forecasts. It looks like exactly what I want my system to do though. Is there anything obvious I'm missing? As you can probably tell, very new to HA (and my solar system).

'
Inverter Model : H1-5.0-E
Panels: 10 x 405W
Batteries: 2 x 4.3 kW Energy Cube
Charger: Zappi v2
Nissan Leaf
HomeAssistant
Dave Foster
Posts: 822
Joined: Thu Oct 13, 2022 7:21 pm

awignall1 wrote: Sat Jul 29, 2023 10:40 pm Hi Nathan,
Trying out your Foxess EM integration, can't seem to get it started - its accepted all Fox cloud/Solcast inputs but all the entities are 'Unknown' except the solcast forecasts. It looks like exactly what I want my system to do though. Is there anything obvious I'm missing? As you can probably tell, very new to HA (and my solar system).

'
I would recommend you open an issue on github as Nathan will pick that up straight away - https://github.com/nathanmarlor/foxess_em/issues
awignall1
Posts: 4
Joined: Sat Jul 29, 2023 10:30 pm

Appeared reloading the integration did it in the end.
Inverter Model : H1-5.0-E
Panels: 10 x 405W
Batteries: 2 x 4.3 kW Energy Cube
Charger: Zappi v2
Nissan Leaf
HomeAssistant
siobhanellis
Posts: 5
Joined: Fri Aug 11, 2023 1:49 pm

Hi, I love the concept and I've just moved to a Tariff that has an off-peak setting.

I'm a little confused about the switch, "Disable Auto Charge". This was "on" by default, so does that meant it disables the built in fox auto charge or does it mean it disables this HA integration?

Thanks
Dave Foster
Posts: 822
Joined: Thu Oct 13, 2022 7:21 pm

siobhanellis wrote: Mon Sep 18, 2023 11:44 am Hi, I love the concept and I've just moved to a Tariff that has an off-peak setting.

I'm a little confused about the switch, "Disable Auto Charge". This was "on" by default, so does that meant it disables the built in fox auto charge or does it mean it disables this HA integration?

Thanks
The 'Disable Auto Charge' basically allows the integration to keep running but it doesn't action any changes to the charge schedule - When it is first installed it needs 2 full days of house load data so that it can work out your average per day.

When the switch is 'on' it will gather the solcast forecasts, and update all it's sensors so you can see what it calculations it is making and then when you are happy that you want it to start making changes to your charge schedule - set the 'Disable Auto Charge' switch to off.
siobhanellis
Posts: 5
Joined: Fri Aug 11, 2023 1:49 pm

Dave Foster wrote: Mon Sep 18, 2023 2:46 pm
siobhanellis wrote: Mon Sep 18, 2023 11:44 am Hi, I love the concept and I've just moved to a Tariff that has an off-peak setting.

I'm a little confused about the switch, "Disable Auto Charge". This was "on" by default, so does that meant it disables the built in fox auto charge or does it mean it disables this HA integration?

Thanks
The 'Disable Auto Charge' basically allows the integration to keep running but it doesn't action any changes to the charge schedule - When it is first installed it needs 2 full days of house load data so that it can work out your average per day.

When the switch is 'on' it will gather the solcast forecasts, and update all it's sensors so you can see what it calculations it is making and then when you are happy that you want it to start making changes to your charge schedule - set the 'Disable Auto Charge' switch to off.
Brilliant! Thanks so much.

Could've done with it today.

So, do I turn off the Fox automatic charging?
Dave Foster
Posts: 822
Joined: Thu Oct 13, 2022 7:21 pm

siobhanellis wrote: Mon Sep 18, 2023 3:59 pm So, do I turn off the Fox automatic charging?
If by that you mean the battery charge times that are set in the app, no you can leave them set as they are. The moment you switch 'off' Disable Auto Charge the EM integration will take over setting and unsetting the Fox charge times as it needs.
siobhanellis
Posts: 5
Joined: Fri Aug 11, 2023 1:49 pm

Another question.

This had been working well for me, and then the other day I had SOC (On Grid) at 100%, so it didn't discharge the battery at all. I found moving SOC (On Gris) down to 10% caused the battery to be used.

Now I hadn't changed that.

So, should it be 10%? If it should be 100%, then I've got something else going wrong.
Dave Foster
Posts: 822
Joined: Thu Oct 13, 2022 7:21 pm

siobhanellis wrote: Wed Nov 08, 2023 4:18 pm Another question.

This had been working well for me, and then the other day I had SOC (On Grid) at 100%, so it didn't discharge the battery at all. I found moving SOC (On Gris) down to 10% caused the battery to be used.

Now I hadn't changed that.

So, should it be 10%? If it should be 100%, then I've got something else going wrong.
SoC on grid should be set to 10% not 100%, the EM integration does control SoC and sets it to 100% to stop discharge so there could have been an error that stopped it from resetting to your default 10%.

The Foxcloud has had a few problems in the early hours over the past few days so it could well have been that which caused it, if it wasn't available when it needed to be reset it would have put an error in your logs but there's nothing else it can do. It might be worth keeping an eye on the Grid SoC setting if the Foxcloud is having issues.
siobhanellis
Posts: 5
Joined: Fri Aug 11, 2023 1:49 pm

Great, good to know. Guess I'll have to set up the direct control.

thanks
ImAFK
Posts: 3
Joined: Sat Jun 10, 2023 11:48 am

This looks great, is it compatible with the Agile tariff, or possible to extend functionality for it?
14 x 420w panels
FoxESS H1-3.7-E Inverter
4 x 2.5kwh batteries
Post Reply