Smart Energy Arbitrage System (Octopus Energy + Enphase + Solcast)

Hey everyone! I wanted to share a comprehensive, fully automated energy management system I built for Home Assistant. I’m new to Home Assistant, so I’m learning as I go, I’ve been using Home assistant for about a month so far. This is my first project and I’ve used rather a lot of AI to help with maths, yaml etc, I know what I want and i have some programming experience, but not HA/YAML. As I’m new to this and there’s lots of AI gone into it, I have to say there is certainly a non 0 chance there’s errors, logic issues, missing dependencies in my list etc.

If you are based in the UK on an Octopus Energy dynamic tariff (like Agile, Intelligent, or Flux) and have an Enphase solar/battery ecosystem, this setup is designed to completely automate your battery to maximize arbitrage profits and minimize grid imports.

Rather than just sharing complex YAML templates, I’ve converted the entire automation engine into a suite of Blueprints so it is incredibly easy to import and set up with your specific sensors.

:sparkles: Key Features:

  • Smart Peak Export: Automatically dumps battery power to the grid during the most profitable slots (e.g., 16:30-19:00) while dynamically holding back enough reserve to power your house through the evening based on historical load.
  • Predictive Grid Charging: Calculates if it is mathematically profitable to charge the battery overnight from the grid, based on tomorrow’s Solcast predictions and your specific battery Round Trip Efficiency (RTE).
  • Winter / Summer Modes: Dynamically adjusts battery reserve floors and evening consumption estimates based on the season.
  • EV Charging Failsafe: Hard blocks exporting when your EV is charging on a cheap rate (Octopus Intelligent GO for example).
  • Daily ROI Audits: Sends a detailed daily email breaking down your solar generation, peak avoidance savings, and net profit/loss.

:package: Prerequisites: You will need the following custom integrations installed via HACS:

  1. Octopus Energy Integration (by BottlecapDave)
  2. Solcast PV Forecast (by BJReplay)
  3. Native Enphase Envoy Integration
  4. hacs_enphase_envoy_cloud (by chinedu40)

:gear: How to Install: I’ve put together a full GitHub repository containing the Blueprints, the required helper variables (system_settings.yaml), the profit calculation templates, and a custom Lovelace Dashboard code.

:link: Get the files and read the setup guide on GitHub here

I’d love to hear your feedback or if you have any suggestions for improving the arbitrage logic! (But be gentle, I’m a newb and still don’t really know what I’m doing!)

Hey everyone,

I’ve just pushed a massive v3.0 update to my public Home Assistant Smart Arbitrage repo, and if you are running an Enphase battery with Octopus Energy (Agile, Intelligent Go, or Flux), you might want to check this out.

For a long time, my system was great at dumping power out to the grid during the 16:00-19:00 peak, but grid charging was still pretty dumb (e.g., “Charge to 100% every night if tomorrow’s total forecast is bad”).

The problem: If the forecast was bad in the morning but sunny in the afternoon, the battery would sit at 100% from grid power, and I’d end up exporting my free afternoon solar for pennies.

The v3.0 Fix: I’ve rewritten the logic to actually parse the Solcast array for the morning window specifically. At 23:30, it looks at how much sun you’ll get before 11:00 AM, calculates your morning household deficit, and generates a Target SOC. It charges the battery just enough to get you through breakfast, leaving the rest of the battery empty to soak up the free afternoon sun.

Other new features in the repo:

  • IOG Daytime Rescue: If Intelligent Octopus randomly triggers a cheap daytime EV slot, HA checks if your house battery is struggling. If it is, it hijacks the cheap rate to top up the house.
  • Hardware Watchdogs: An aggressive failsafe automation that watches your Enphase gateway. If the battery ever tries to charge from the grid when rates are expensive (due to HA reboots or accidental manual overrides), it kills the switch instantly.
  • Everything is Blueprints: You don’t have to write any YAML. Just import the blueprints, pick your Envoy/Octopus sensors from the drop-downs, and you’re good to go.

You can check out the full README and grab the blueprints here: GitHub - dave2318/HA-Enphase-Octopus · GitHub

Let me know what you think or if you have any ideas for V4!