How to set up Predbat — the complete guide for Fox ESS and Octopus Agile
Predbat is the Home Assistant add-on that automatically plans your battery charging and discharging based on Octopus Agile prices and solar forecasts. Here's how to get it running.
Predbat is the reason my battery system is genuinely smart rather than just sitting there. It reads Octopus Agile prices 48 hours ahead, checks the solar generation forecast, and plans every charge and discharge slot automatically. Once set up, it’s completely hands-off.
This guide covers setting it up for a Fox ESS inverter on Octopus Agile. The principles are the same for other supported inverters (Givenergy, Solis, Solaredge, etc.) but the specific sensor names will differ.
What Predbat actually does
Before diving into setup, it’s worth understanding what Predbat optimises:
- Charges the battery when Agile prices are cheapest (usually midnight–4am)
- Avoids charging when solar will fill the battery anyway
- Reserves battery capacity for high-price periods (typically 4–7pm)
- Exports to grid when prices are high enough to be worth it (if your inverter supports it)
- Plans 48 hours ahead — so if tomorrow is forecast to be very sunny, it won’t bother charging tonight
The result: your battery charges when electricity is cheapest, discharges when it’s most valuable, and you barely touch expensive grid electricity.
Prerequisites
Before installing Predbat you need:
- Home Assistant running (any hardware)
- HACS (Home Assistant Community Store) installed
- Fox ESS integration installed and connected (or equivalent for your inverter)
- Octopus Energy integration installed in HA
- Solcast account (free tier works) for solar forecasting
I’ll cover each of these briefly before getting to Predbat itself.
Step 1 — Install HACS
HACS is the community store that gives you access to add-ons (including Predbat) that aren’t in the official HA store.
- Go to hacs.xyz and follow the installation instructions
- In HA: Settings → Add-ons → Add-on Store — HACS appears after restart
- Open HACS → click the three dots → Custom repositories
- You can now search for and install community integrations
Step 2 — Install the Octopus Energy integration
This pulls your live Agile rates into Home Assistant.
- In HACS → Integrations → search Octopus Energy
- Install and restart HA
- Go to Settings → Integrations → Add integration → Octopus Energy
- Enter your Octopus API key (find this in your Octopus account under Developer settings)
- Select your electricity meter
Once configured you’ll have sensors like:
sensor.octopus_energy_electricity_XXXX_current_rate— current p/kWhsensor.octopus_energy_electricity_XXXX_next_rate— next half-hour rate
These are what Predbat reads for price planning.
Step 3 — Install the Fox ESS integration
This is how Predbat reads and controls your inverter. For Fox ESS, the Predbat team maintain a dedicated integration.
- In HACS → Integrations → search Fox ESS or add the custom repository:
https://github.com/nathanmarlor/foxess_modbus - Install and restart
- Go to Settings → Integrations → Add integration → FoxESS Modbus
- Enter your inverter’s local IP address (find it in your router’s DHCP list)
- Select your inverter model
You’ll now have sensors like:
sensor.foxess_pv_power— solar generation wattssensor.foxess_battery_soc— battery percentagesensor.foxess_grid_power— grid import/export
Check your exact sensor names in Developer Tools → States — search for foxess.
Step 4 — Set up Solcast (solar forecasting)
Predbat uses Solcast to predict how much solar you’ll generate over the next 48 hours. The free tier gives you 10 API calls per day — enough for Predbat’s needs.
- Sign up at solcast.com (hobbyist/free tier)
- Create a rooftop site — enter your location, panel count, azimuth (south = 180°), and tilt
- Copy your API key and Resource ID
In Home Assistant, install the Solcast PV Forecast integration via HACS:
- HACS → Integrations → search Solcast PV Forecast
- Install and configure with your API key
- You’ll get sensors like
sensor.solcast_pv_forecast_todayshowing expected kWh
Step 5 — Install Predbat
Now everything is in place to install Predbat itself.
- In HACS → Integrations → three dots → Custom repositories
- Add:
https://github.com/springfall2008/batpred - Category: Integration
- Search Predbat and install
- Restart Home Assistant
- Go to Settings → Integrations → Add integration → Predbat
Step 6 — Configure Predbat
Predbat’s configuration file is predbat.yaml — you’ll find it in your HA config directory. This is where you tell it about your system. Open it via File Editor or Studio Code Server add-on.
Essential settings:
# Your inverter brand
inverter_type: Fox
# Battery settings
battery_size: 10.3 # kWh total capacity
battery_rate_max: 3.0 # kW max charge/discharge rate
battery_loss: 0.07 # Round-trip loss (7% is typical)
battery_min_soc: 10 # Minimum SOC to keep (%)
# Solcast solar forecast
solcast_host: https://api.solcast.com.au
solcast_api_key: YOUR_API_KEY
solcast_resource_id: YOUR_RESOURCE_ID
# Octopus Agile - your rate sensor name
metric_octopus_import: sensor.octopus_energy_electricity_XXXX_current_rate
metric_octopus_export: sensor.octopus_energy_electricity_XXXX_export_current_rate
# Fox ESS sensor names (check yours in Developer Tools → States)
pv_power: sensor.foxess_pv_power
soc_kw: sensor.foxess_battery_soc
inverter_power: sensor.foxess_battery_power
grid_power: sensor.foxess_grid_power
# Your electricity standing charge (pence)
metric_standing_charge: 62.0
Charge window settings:
# How far ahead to plan (hours)
forecast_hours: 48
# Minimum battery to reserve for evening
best_soc_min: 10 # % — never go below this
best_soc_keep: 20 # % — aim to keep this for emergencies
# Export settings (if your inverter supports forced export)
inverter_can_export: true
best_export_rate: 15.0 # Only export if rate > this (pence)
Step 7 — Test it
After saving the config, check the Predbat panel in Home Assistant:
- Go to Settings → Integrations → Predbat → Configure
- Or search for
predbatin your HA dashboard
You should see:
- Charge plan — a list of upcoming cheap slots it plans to charge in
- Battery SOC curve — predicted battery level over the next 48 hours
- Import/export plan — when it expects to buy or sell electricity
If the plan looks sensible (charging at cheap overnight slots, discharging at peak times) — you’re done.
Common issues
Predbat isn’t charging at cheap times
- Check your Octopus rate sensor name is correct in the config
- Make sure the rate sensor is showing the right value in Developer Tools
Solar forecast is wrong
- Double-check your Solcast panel azimuth (south = 180°, west = 270°, east = 90°)
- Make sure your tilt angle is correct
Battery isn’t reaching target SOC
- Check
battery_rate_max— if it’s too high for your inverter, charging will be cut short - Check the inverter charge limit in your Fox ESS settings
Predbat shows an error
- Check the HA logs: Settings → System → Logs — search for Predbat
How long does setup take?
Honestly? Half a day if you’re comfortable with Home Assistant, a full weekend if you’re new to it. The Octopus and Fox integrations are the fiddly part — finding the right sensor names for your specific setup.
Once it’s running, you’ll never need to touch it again. Predbat has been running hands-off in my house for 17 months. It charges every night at cheap/negative Agile rates and the battery covers my evening peak. My average effective import rate works out around 12p vs 28p on a standard flat tariff.
The setup time pays for itself within weeks.
Further reading
If you’re setting this up on a fresh Home Assistant installation, start with the Yellow guide first: