Page 1 of 1
[HA Integration] Energy Management
Posted: Mon Oct 17, 2022 12:38 pm
by nathanmarlor
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.
Re: [HA Integration] Energy Management
Posted: Mon Oct 17, 2022 2:38 pm
by Will
Great work, nice one!
Re: [HA Integration] Energy Management
Posted: Mon Oct 17, 2022 3:08 pm
by StealthChesnut
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?
Re: [HA Integration] Energy Management
Posted: Mon Oct 17, 2022 3:28 pm
by nathanmarlor
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...!
Re: [HA Integration] Energy Management
Posted: Fri Oct 21, 2022 8:57 am
by nathanmarlor
** 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...!
Re: [HA Integration] Energy Management
Posted: Sat Jul 29, 2023 10:40 pm
by awignall1
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).
'
Re: [HA Integration] Energy Management
Posted: Sun Jul 30, 2023 1:39 pm
by Dave Foster
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
Re: [HA Integration] Energy Management
Posted: Mon Jul 31, 2023 1:16 pm
by awignall1
Appeared reloading the integration did it in the end.
Re: [HA Integration] Energy Management
Posted: Mon Sep 18, 2023 11:44 am
by siobhanellis
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
Re: [HA Integration] Energy Management
Posted: Mon Sep 18, 2023 2:46 pm
by Dave Foster
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.
Re: [HA Integration] Energy Management
Posted: Mon Sep 18, 2023 3:59 pm
by siobhanellis
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?
Re: [HA Integration] Energy Management
Posted: Tue Sep 19, 2023 9:34 am
by Dave Foster
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.
Re: [HA Integration] Energy Management
Posted: Wed Nov 08, 2023 4:18 pm
by siobhanellis
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.
Re: [HA Integration] Energy Management
Posted: Wed Nov 08, 2023 4:35 pm
by Dave Foster
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.
Re: [HA Integration] Energy Management
Posted: Fri Nov 10, 2023 1:39 pm
by siobhanellis
Great, good to know. Guess I'll have to set up the direct control.
thanks
Re: [HA Integration] Energy Management
Posted: Sun Nov 12, 2023 8:02 pm
by ImAFK
This looks great, is it compatible with the Agile tariff, or possible to extend functionality for it?