Home Assistant Automations for Fox ESS - sofapi/HA_Automations GitHub Wiki
Energy Management Automation Based on Solcast Future PV Output
Overview
The purpose of this section is to guide you through the setup of an Energy Management Automation that fine-tunes your charge periods for the upcoming day, based on the Solcast future photovoltaic (PV) output forecasts. The crux of this approach is the integration of PV output predictions, the size of your battery and PV array, as well as your daily load utilisation into a single, cohesive automation.
Context: My Own Setup
As a point of reference, my setup includes a 3.7Kwh inverter paired with a 16kwh battery. This configuration aligns well with my 4-hour 'off-peak charge window' and effectively meets my daily energy consumption, which ranges from 14-20kwh.
Customisation & Considerations
While the timings and specifications outlined here have been tailored for my setup, they can serve as a strong starting point for anyone looking to improve the automation of their own charging cycles. Here are some key considerations:
- PV Array Size: The dimensions of your PV array will influence the rate at which your battery charges from solar power.
- Battery Capacity: A larger battery might require a longer charge period, depending on your energy consumption habits.
- Load Utilisation: Understanding your daily energy consumption will help you fine-tune your automation for optimal performance.
- Solcast Predictions: Incorporating accurate PV output forecasts enables your system to adapt to varying weather conditions and solar availability.
Conclusion
By thoughtfully combining your PV output forecasts with your hardware specifications and daily energy consumption, you can develop an efficient and adaptive automation strategy. This ensures that you're making the most of your renewable energy resources and reducing your reliance on the grid, particularly during peak hours.
This guide also adds in consideration for an entity, and gauge which you can populate on your dashboards to keep a log of charge times:
Pre-requisites:
- It is assumed you will have the Solcast Add-on installed to continue, I have successfully incorporated this one: https://github.com/oziee/ha-solcast-solar.
- Home Assistant successfully installed, with some working knowledge of your way around.
- A direct connection to your Fox Ess solution via Modbus (preferably this one: https://github.com/nathanmarlor/foxess_modbus)
Scheduled Automations
Automation 1
Reset Daily Charge Windows and Prevent Discharge
Objective
To ensure optimal battery management, automate the process to reset daily charge windows and set a default period during which battery discharge is prevented. This aids in maintaining a clean slate each day and utilises grid power during low-cost hours.
Pre-requisites
- Familiarity with setting up automations in your desired platform.
- Access to your inverter settings and ID.
Steps
-
Initialise New Automation:
- Create a new automation and configure the trigger for a Fixed Time. For example, set it to trigger at 22:30 each day.
-
Select Call Service:
- Choose the service option "Fox Ess - Modbus: Update Charge Period".
-
Choose Inverter:
- From the device drop-down menu, select your inverter.
- Note: If you're operating in YAML, you'll need your inverter ID. Click on the three dots next to the service option and select 'Show in YAML' to reveal your ID for later use.
-
Configure Time Periods:
-
Time Period 1:
- Set time to 00:00.
- De-select the options for 'Charge from Grid' and 'Force Charge'.
-
Time Period 2:
- Repeat the same settings as Time Period 1.
-
-
Set Protected Discharge Period:
- Create another action in the automation.
- Set the time period (e.g., 00:30 - 04:30).
- Ensure to check the 'Enable Force Charge' option while NOT enabling 'Charge from Grid'.
Rationale
The automation serves to reset all variables at the end of each day, avoiding carry-over data and possible errors. It also sets a default period where the house will consume power from the grid when rates are cheaper, thereby preserving battery life.
Automation 2
One Hour Charge for High PV Day Forecast with Low SoC
Objective
This advanced automation is designed to provide an hour of charging to get you through the morning if a high PV (Photovoltaic) day is forecasted, but your current state of charge (SoC) is low.
Pre-requisites
- Basic understanding of automation creation and conditions.
- Access to Solcast PV Forecast and FoxEss - Modbus devices.
Steps
-
Initialise New Automation:
- Create a new automation and set the trigger for a Fixed Time at 23:45 each day.
-
Add Conditions:
-
Click 'Add Condition'. Note that all conditions must be met for the automation to activate.
-
Condition 1:
- Add Device: Solcast PV Forecast.
- Choose condition: Current Solcast PV Forecast Forecast Tomorrow Energy.
- Set the threshold to above 14 KwH.
-
Condition 2:
- Add Device: FoxEss - Modbus.
- Choose condition: Current Battery SoC Battery Level.
- Set the threshold to below 15%.
-
-
Select Service:
- Choose "Fox Ess - Modbus: Update Charge Period".
-
Configure Time Period:
- Time Period 1:
- Set the time to 00:30 - 01:30.
- Select both 'Charge from Grid' and 'Force Charge'.
- Time Period 1:
Rationale
This automation ensures that you optimise your battery charge for the next day's high PV forecast while considering a low current state of charge. It acts as a contingency plan to make the most out of the available solar energy while maintaining your battery health.
Automation 3
Two Hours of Charge for Medium PV Day Forecast
Objective
This automation aims to provide two hours of charging against a forecast of a moderately sunny day. After accounting for house load, the goal is to maintain a 20-30% battery capacity by day's end.
Pre-requisites
- A basic understanding of how to create automations and set conditions.
- Access to Solcast PV Forecast and FoxEss - Modbus devices.
Steps
-
Initialise New Automation:
- Create a new automation and set the trigger to a Fixed Time, specifically at 23:45 each day.
-
Add Conditions:
-
Click 'Add Condition', implying that all conditions must be met for the automation to proceed.
-
Condition 1:
- Add Device: Solcast PV Forecast.
- Choose condition: Current Solcast PV Forecast Forecast Tomorrow Energy.
- Set the above threshold to 8 KwH and the below threshold to 14 KwH.
-
Condition 2:
- Add Device: FoxEss - Modbus.
- Choose condition: Current Battery SoC Battery Level.
- Set the threshold to below 40%.
-
-
Select Service:
- Opt for "Fox Ess - Modbus: Update Charge Period".
-
Configure Time Period:
- Time Period 1:
- Set the time to 00:30 - 02:30.
- Enable both 'Charge from Grid' and 'Force Charge'.
- Time Period 1:
Rationale
This automation is a middle-ground approach to manage your energy storage efficiently based on moderate PV forecasts. It serves as a reliable strategy to balance solar energy utilisation while keeping your battery in a healthy state.
Automation 4
One Hour of Charge for Medium PV Day with High SoC
Objective
This automation is geared towards medium solar forecast days, with the intention to leave your battery at a 20-30% capacity by the end of the day after fulfilling house load requirements.
Pre-requisites
- Familiarity with automation creation and conditional triggers.
- Access to Solcast PV Forecast and FoxEss - Modbus devices.
Steps
-
Initialise New Automation:
- Create a new automation and configure the trigger for a Fixed Time at 23:45 each day.
-
Add Conditions:
-
Click 'Add Condition'. Note that all conditions must be satisfied for the automation to activate.
-
Condition 1:
- Add Device: Solcast PV Forecast.
- Choose condition: Current Solcast PV Forecast Forecast Tomorrow Energy.
- Set the above threshold to 8 KwH and the below threshold to 14 KwH.
-
Condition 2:
- Add Device: FoxEss - Modbus.
- Choose condition: Current Battery SoC Battery Level.
- Set the threshold to below 60%.
-
-
Select Service:
- Choose "Fox Ess - Modbus: Update Charge Period".
-
Configure Time Period:
- Time Period 1:
- Set the time to 00:30 - 01:30.
- Select both 'Charge from Grid' and 'Force Charge'.
- Time Period 1:
Rationale
This automation aims to optimise your energy management on days with moderate solar forecasts, while accounting for a higher current State of Charge (SoC). It aims to make the most of available solar energy, as well as maintain battery health and house load requirements.
Automation 5
Four Hours of Charge for Low PV Day with SoC Below 80%
Objective
This automation is tailored for days with poor solar forecasts. The intent is to ensure that the battery is left with a 20-30% capacity by the end of the day, after accounting for house load.
Pre-requisites
- A grasp of basic automation setup and the use of conditions.
- Access to Solcast PV Forecast and FoxEss - Modbus devices.
Steps
-
Initialise New Automation:
- Create a new automation and configure the trigger to be a Fixed Time at 23:45 each day.
-
Add Conditions:
-
Click 'Add Condition'. Note that all conditions must be fulfilled for the automation to run.
-
Condition 1:
- Add Device: Solcast PV Forecast.
- Choose condition: Current Solcast PV Forecast Forecast Tomorrow Energy.
- Set the above threshold to 0 KwH and the below threshold to 8 KwH.
-
Condition 2:
- Add Device: FoxEss - Modbus.
- Choose condition: Current Battery SoC Battery Level.
- Set the threshold to below 80%.
-
-
Select Service:
- Choose "Fox Ess - Modbus: Update Charge Period".
-
Configure Time Period:
- Time Period 1:
- Set the time to 00:30 - 04:30.
- Select both 'Charge from Grid' and 'Force Charge'.
- Time Period 1:
Rationale
This automation is aimed at maximizing the efficiency of your energy storage and consumption during low solar forecast days, while keeping the State of Charge (SoC) below 80%. By adhering to this strategy, you will be able to make the most of a less than ideal situation, ensuring energy availability and battery health.
Extra Option:
To add the entity so you can track charge times and produce a gauge on your dashboard add the following into your configuration.yaml
input_select:
charge_duration_select:
name: "Charge Duration Select"
options:
- "0"
- "1"
- "2"
- "3"
- "4"
Initial: "0"
You can then add this to your Dashboard by adding the entity 'Charge Duration Select' as a gauge and have your automation add however many hours you configured in your automation.
You can also add the following to your automations:
service: input_select.select_option
data:
option: "X"
target:
entity_id: input_select.charge_duration_select
Remember to replace X in each automation with how many hours you are charging for.