Sourceful Energy
Grid connectionPlatformServicesAboutBlog
Insights and analysis·9 min read
Back to Journal
Insights and analysis

How we build an open-source energy management system with data

How FTW decides what your battery, car and heat pump do, why it never stops adjusting, and how we check on a real house that it actually saves money.

By Fredrik Ahlgren·August 31, 2026·9 min read
How we build an open-source energy management system with data

You have solar on the roof, a battery in the garage, an electric car and a heat pump. Every day the same questions come up. Should the battery charge now or later? Will the car be ready by seven? Is it worth running the heat pump before the evening price peak? And who is going to keep track of all that?

FTW is. FTW is Sourceful's open EMS: an open-source energy management system that runs in your house on a small computer, with a web app, open hardware drivers, forecasts, optimisation and local safety control. It is the open software behind the Grid Connection Platform. This post explains how it thinks, why it never stops adjusting, and how we check on a real house that it actually saves money. FTW's core, clients and drivers are open code. The planner inside it, Energyplan, is Sourceful's own proprietary software. The method is open: measure on a real house, publish the numbers, and correct them in public when they were wrong.

Two parts, two jobs

Think of a long drive. Before you leave, you plan the route: which roads, where to stop, when you need to be there. Then you drive, and you brake for the car in front and steer through the bend without redoing the whole route. FTW has both of those jobs, done by two different parts.

The planner thinks ahead. It looks at the next two days: the electricity prices, the weather forecast, how much your house usually uses, how full the battery is, when the car has to be ready. From that it works out the cheapest way to run the house without breaking any rules: the main fuse, the battery's limits, your comfort. It cannot try every combination, there are far too many. Instead it works backwards from the end of the two days, asking at every step what it is worth to have the battery at each level, and reads off the best move for right now. On a small computer like a Raspberry Pi that takes a fraction of a second.

The control loop acts now. It lives right next to the hardware and runs all the time. It carries out the planner's decision and keeps the house inside its limits, the main fuse first of all, and it does that in milliseconds, without waiting for a new plan. If the oven, the car charger and the heat pump all draw at once, the control loop is what keeps you on the right side of the fuse.

Neither part can do the other's job. A control loop on its own does not know that power will be cheap at three in the morning. A planner on its own cannot react in milliseconds. Both have their role in FTW.

If you want the long version of how the planner thinks, I recorded a deep dive for my podcast Coordinated with Fredrik: Subject To. It covers what an optimiser actually does, why the price falls out of the answer as a by-product, and why an optimal decision so often feels wrong afterwards.

Why it never stops adjusting

Many energy systems make one schedule a day. Tomorrow's prices publish around 13:00, a server computes a plan, and the plan runs until the next one. Your day does not work like that. Clouds come in. You come home early and plug in the car. Someone turns on the sauna.

So FTW does not keep its plan. It makes a two-day plan, carries out only the next quarter of an hour, and then throws the plan away and makes a new one. By default every quarter of an hour, all year. And whenever the house uses more or less than the forecast said, or the sun does something else, the planner replans straight away instead of waiting. Because a plan takes a fraction of a second, it can do that as often as every minute. Meanwhile the control loop keeps the house safe between plans.

That is the whole point of a fast planner. The plan for tonight is only a guess. The decision for the next quarter of an hour is what reaches the battery, and that decision is always fresh. You do not have to touch anything.

It all runs in the house with no cloud in the control path. Nothing waits for a server to answer. Fast decisions and safety limits stay in the house, even when the internet is down.

How do we know it actually saves money?

A fair question. Any app can show a nice graph. The only test that counts is what actually happened in a real house.

So we record every situation the house goes through: the battery level, the forecasts, the prices, everything the planner knew at that moment. Any of them can be replayed later, so two versions of the planner can be run on the same situation and compared. When we change something, the old version keeps running beside the new one for a while. It controls nothing. It only logs where the two disagree.

The strict test is to take a real week and replay it properly: start from the state the house was actually in, let the planner make only its first move each quarter of an hour, and charge it for that move against the sun, the consumption and the prices as they really turned out. A plan on paper can look cheap. This test says what it would have cost you.

What a real week taught us

We once spent a month on a small, consistent difference between two versions of the planner, and were wrong about the cause three times. Each time a measurement killed the idea within a day. Then we ran the strict test on a real week, 24 to 31 August, and it showed what actually moves the bill.

What we changedEffect on the week's costHow often the battery did something different
How energy left in the battery at the end of the plan is valued0 kronor0 of 550
The guess about tomorrow's prices0.23 kronor4 of 550
Knowing sun, consumption and prices in advance15.49 kronor cheaper, 21%316 of 550

Read it like this. The first two rows barely move the bill, and our test cannot tell numbers that small from noise: the simulated cost ran 13% above what the meter actually recorded, so anything smaller than that sits inside the error bar. The limits are real too: one house, one price zone, and three usable days, because the box was down for 91 hours of that week.

One row is different. If the planner had known in advance exactly how much sun would come, how much the house would use and what prices would be, the week would have cost 21% less, about 5 kronor a day on this house. Nobody knows that in advance. But better forecasts get you part of the way there, and that is where we are working now.

Two things the data fixed on the way

Measuring also finds things nobody was looking for.

The planner plans on a little less sun than the forecast promises, so a cloudy afternoon does not leave the house short. The old safety margin took the same fixed amount off every quarter of an hour, which wiped out the morning and the evening sun completely. That caution cost 25 to 65 kronor per plan. Now the margin scales with how much sun is expected.

And a plan that sat exactly on the fuse limit was rejected over a rounding difference of about a billionth of a watt. The house quietly fell back to a backup planner and said nothing. A small tolerance fixed it. Neither fault was on anyone's list. Both were in the data.

What this means for you

  • Your battery, car and heat pump follow a plan that is never more than a quarter of an hour old, and often fresher. You do not have to touch anything.
  • The main fuse and the battery's limits are guarded in the house, in milliseconds, and the house keeps running when the internet does not.
  • The system is tested against real outcomes, not a demo, and what we find is published, including the numbers we had to correct.

Open code, open method

A home energy system earns its money by doing the sane thing every quarter of an hour, all year, on a box nobody looks at. The only way to know it is sane is to measure it against what actually happened rather than against what we expected. That is how we build FTW. Open code does not remove responsibility: Sourceful runs the hosted platform, the encrypted relay access, the supported integrations and agreed operations, and publishes the common layer so others can inspect it, add hardware and run it. The planner itself, Energyplan, is not part of that open layer. It is Sourceful's own proprietary software, free for private households running FTW and licensed separately for commercial use.

Summary

  1. FTW has two parts. The planner thinks two days ahead and finds the cheapest way to run the house. The control loop sits next to the hardware and keeps the house safe and on plan, in milliseconds.
  2. The planner carries out only the next quarter of an hour, then replans: every 15 minutes by default, and straight away when the house or the sun does something other than forecast.
  3. Everything runs in the house, with the safety limits guarded locally, even without internet.
  4. We test it against what actually happened in a real house and publish the numbers, including the ones we had to correct.
  5. With a perfect forecast this house would have paid 21% less that week. Better forecasts are where the work goes next.

Read more on our open-source page, run FTW yourself with the Home Assistant add-on (beta), or follow the projects on GitHub. For the long version of how a planner thinks, listen to Subject To on Coordinated with Fredrik.

Share this article
XLinkedIn
Explore related topics
C&I Batteries & OptimisationEnergy Management & ControlLocal Generation & Storage
03 · RelatedMore Articles
View All
A Wake-Up Call for Europe’s Energy Future
Insights and analysis

A Wake-Up Call for Europe’s Energy Future

Fredrik Ahlgren · Apr 28, 2025
Europe’s Energy Future Starts on the Rooftop
Insights and analysis

Europe’s Energy Future Starts on the Rooftop

Viktor Rosén · Apr 15, 2025
The Great Energy Transformation: Why Timing is Everything
Insights and analysis

The Great Energy Transformation: Why Timing is Everything

Fredrik Ahlgren · Dec 13, 2024
Sourceful Energy

Sourceful is the Grid Connection Platform. We create value from the electrical capacity already available at commercial and industrial sites.

The Source

Monthly notes on grid connections, local capacity, energy markets and the systems that create value from them.

Product
  • Grid connection
  • Platform
  • Services
  • Developers
Company
  • About
  • Master Plan
  • Open source
  • Blog
  • Press Kit
Support
  • Get in Touch
  • Support
© 2026 Sourceful Labs AB · Sourceful Energy
Privacy PolicyTerms of Service
EN|SV
Made in Kalmar, Sweden

All savings, costs, and financial figures shown are estimates for illustrative purposes only. Actual results depend on your specific setup, energy consumption patterns, electricity prices, and local regulations. This content is provided for informational purposes only and does not constitute financial, investment, or legal advice.