Dear community!
I have created a new project called EMHASS, written in Python, to implement an optimized energy management for a household and with easy integration to Home Assistant. The main contribution of this project is that the energy management strategy is… well… optimized! I’ve done this using a real mathematical optimization technique called Linear Programming.
The main use case for this project will be for someone who has installed some PV solar panels in his house and is already using Home Assistant to control (on/off) some crucial power consumption in his home. For example the water heater, the pool pump, a dispatchable dishwasher, and so on. We can also imagine that he has installed an optional battery like a PowerWall, in order to maximize the PV self-consumption. With Home Assistant he also has sensors that can measure the power produced by the PV plant, the global power consumption of the house and hopefully the power consumed by the controllable loads. Home Assistant has just released the Energy Dashboard where we can visualize all these variables in some really good looking graphics. See: https://www.home-assistant.io/blog/2021/08/04/home-energy-management/.
Now the questions are, how can we be certain of the good and optimal management of these devices? If we define a fixed schedule for our deferrable loads, is this the best solution? When we can indicate or force a charge or discharge on the battery? When should I optimally start my water heater? This is a well known academic problem for an Energy Management System.
The first and most basic approach could be to define some basic rules or heuristics, this is the so called rule-based approach. The rules could be some fixed schedules for the deferrable loads, or some threshold based triggering of the battery charge/discharge, and so on. The rule-based approach has the advantage of being simple to implement and robust. However, the main disadvantage is that optimality is not guaranteed.
The goal of this work is to provide an easy to implement framework where anyone using Home Assistant can apply the best and optimal set of instructions to control the energy flow in a household.
When I was designing and testing this package in my own house I estimated a daily gain between 5% and 8% when using the optimized approach versus a rule-based one. In my house I have a 5 kWp PV installation with a contractual grid supply of 9 kVA. I have a grid contract with two tariffs for power consumption for the grid (peak and non-peak hours) and one tariff for the excess PV energy injected to the grid. I have no battery installed, but I suppose that the margin of gain would be even bigger with a battery, adding flexibility to the energy management. Of course the disadvantage is the initial capital cost of the battery stack. In my case the gain comes from the fact that the EMS is helping me to decide when to turn on my water heater and the pool pump. If we have a good clear sky day the results of the optimization will normally be to turn them on during the day where solar production is present. But if the day is going to be really clouded, then is possible that the best solution will be to turn them on during the non-peak tariff hours, for my case this is during the night from 9pm to 2am. All these decisions are made automatically by the EMS using forecasts of both the PV production and the house power consumption.
Some other good packages and projects offer similar approaches as EMHASS. I can cite for example the good work done by my friends at the G2ELab in Grenoble, France. They have implemented the OMEGAlpes package that can also be used as an optimized EMS using LP and MILP (see: (omegalpes) [OMEGAlpes / OMEGAlpes · GitLab]). But here in EMHASS the first goal was to keep it simple to implement using configuration files and the second goal was that it should be easy to integrate to Home Assistant. I am sure that there will be a lot of room for optimize the code and the package implementation as this solution will be used and tested in the future. I hope that this project come as and can be used as a perfect complement for the just released Energy Management and Energy Dashboard by Home Assistant.
So where to begin?
-
If you have to Home Assistant OS or Supervised then just go for the add-on: https://github.com/davidusb-geek/emhass-add-on
-
Or if you are using Home Assistant with other installation methods as the docker container or HA core then read the installation instructions on the core EMHASS github repository: https://github.com/davidusb-geek/emhass
You will find all the needed instructions to install and use the package, but if you have any questions I will happily try to help anyone interested in this project. Leave a message on this thread or if you find any bugs open new issues on those github repositories.
There is a complete documentation that can be found here: https://emhass.readthedocs.io/
And there is a separate thread presenting the add-on: https://community.home-assistant.io/t/emhass-add-on-an-energy-management-optimization-add-on-for-home-assistant-os-and-supervised/405649
If you like this work please consider buying a coffee