If you want to control a home battery on dynamic prices with Home Assistant, you soon come across EMHASS. It is the heart of my energy system. But what is EMHASS exactly, what does it do and what does it not do, and why did I choose it instead of something simpler?
What is EMHASS?
EMHASS stands for Energy Management for Home Assistant. It is free, open-source software that you run as an add-on next to Home Assistant. It is a calculation module: you give it the expected solar yield, the expected consumption and the electricity prices, and it calculates the cheapest plan for your battery and for consumers you are allowed to shift in time.
Under the bonnet, it is an optimisation problem. Within the limits you specify (battery capacity, charging power, minimum and maximum state of charge, grid connection capacity), EMHASS looks for the plan with the lowest cost or the highest return. That is not a rule of thumb like “charge when it is cheap”, but a calculation across all quarter-hours at once.
How it works
In my setup, EMHASS runs again every quarter of an hour. This is called model predictive control: each run makes a new plan based on the latest data, and only the first part of that plan is executed. If there is less sun than expected, the next run corrects for it.
| What goes in | What comes out |
|---|---|
| Quarter-hourly prices for today and tomorrow | Planned battery power per quarter-hour |
| Solar forecast | Expected state of charge of the battery |
| Expected consumption of the house | Planned grid power: import or export |
| Current state of charge of the battery | When a flexible consumer should run, such as the hot water |
The most important thing to understand: EMHASS does not control anything itself. It publishes its plan as sensors in Home Assistant. What happens with it is up to you, with automations.
Why I chose EMHASS
One plan for several devices
The app of an inverter or energy supplier looks at one device. I wanted the battery and the hot water to be planned together, and later the heating as well. Alongside the battery, EMHASS can plan deferrable loads: consumers that need to run for a certain time, but where the moment does not matter. My 300-litre hot water cylinder is one of them. See the hot water block.
It looks ahead
A simple rule (“charge below €0.20, discharge above €0.35”) does not know that tomorrow morning will also be expensive, or that the sun is about to come out. EMHASS sees the prices and the sun for the next day and a half, and spreads the battery across them. Exactly how far ahead, and why that matters: the EMHASS horizon.
It fits one owner per actuator
My most important design rule is that each device has exactly one piece of software that writes to it. That EMHASS only publishes a plan is therefore an advantage. My own translation layer, the translator, checks the plan, limits it and converts it into the language of my Deye inverter. If EMHASS fails or the plan is too old, the translator puts the inverter into a safe mode.
Open and local
EMHASS runs at home, next to Home Assistant, without a cloud or subscription. I can see exactly what goes in and what comes out. And if something is not right, I can figure it out myself, which I often had to do in the first weeks.
What makes it tricky
- The plan is only as good as the input. A price that is shifted by a quarter of an hour, or a load forecast with the car in it, produces a neat plan for a house that does not exist. See EMHASS thought my house used 6 kW at night.
- The payload is the real work. The EMHASS configuration is almost standard; the choices are in what you send along with every run: prices aligned to the current quarter-hour, remaining hot water hours, your own load forecast.
- You have to build the execution yourself. Without a translator or automations, nothing happens with the plan. For me, that took more time than EMHASS itself.
- Computation time is a limit. A longer horizon is better, until the solver takes too long. For me, that limit was between 144 and 192 quarter-hours.
Who is it for?
EMHASS is interesting if you have a home battery, a dynamic energy contract, and Home Assistant already running. You need to be willing to write templates and read charts. If you only want a battery that charges cheaply at night, the app of your inverter or energy supplier may be enough. If you want several devices in one plan, EMHASS is one of the few options that does so openly and locally.
Ready to start yourself? In Install EMHASS in Home Assistant I walk step by step through the installation, the battery settings and the first optimisation.
How it fits together in my setup, with the settings: EMHASS and the battery. New to Home Assistant? Start at What is Home Assistant?
These experiences apply to one installation. Check settings against your own documentation; leave work on 230/400 V to a qualified electrician.






Leave a Reply