Control energy flow in the building, building energy management, control consumers


I would like to ask if it is possible to using the openHAB mainly for energy management?
What do I mean under energy management? For example we have PV system and we have lots of electric consumers, also we have a battery connected to the inverter. And the aim is to maximize the self-comptumpiton in the building with a good energy management/control unit.
In some openHAB project I have seen that openHAB is fine for energy monitoring, but I did not find a solution for energy controlling.
Thank you for your help in advance.

1 Like

I would like to know the same, but it seems no one wants to answer your question…

I’m searching right now in the forum because I want to do the same and wanted to check if somebody has ideas.

I would say yes, this is possible.

  • You’ve your PV system in openHAB - well done
  • Do you have any consumers to steer also in openhab?
    • HVAC like Daikin or Mitsubishi?
    • Electric Vehicle which can be charged?
    • Heat Pump?
    • Can you steer battery charging?
    • Can you control dishwasher / laundry machine & dryer?

If you’ve both producers & cosnumers available you can connect them via rules. E.g. check time based every 5 min

  • PV production - household consumption > 1000 W &&
  • battery charge level > 50%

then start your consumers sequentially. This would be a first step towards a more sophisticated EMS which directly fits your needs.

@Michael_Walter The answer to this question is not trivial. My proposal above is a glimpse towards a real EMS. Think about forecast of PV production based on weather conditions and see if you can power your household consumers plus charging the electric vehicle. If not is it possible to charge the next day? These questions are hard to formulate in rules.

I’m currently developing such an EMS based on openHAB / rules DSL to accomplish right that, maximize self-consumption by directing excess power to heat pumps and by running the dish washer or washing machine, all based on a forecast of PV production.

Like you said it’s not trivial at all, some 1000 lines of code already I’d estimate I’m at ~80% now.

Crux is, it’ll become part of a commercial solution for Germany. I might provide it for free if you help with beta testing and development though, let me know if you are interested.

For now, you need to a) integrate all your devices yourself and b) know how to control (start/prevent/force) battery charging and your EV, both of which are not standard features and implementation today depends on your PV inverter and wallbox or e-car.

Yes specifying (“formulating” for Germans) run rules is the tricky part. On the EV charging part, I’m trying to limit what the car takes to what’s forecasted as excess power during (sunshine) daytime, minus scheduled consumption. If you start making calculations for more than one day it’s getting too complicated, with too much error potential.
Right now I’m choking on the question how long to feed the heat pump at most, any clever idea appreciated.

Bottom line is you must not end up with an overly complicated solution, it has to be reliable and zero-input in daily operations else people will not keep using it in the long run so it’s a very thin line between correctness/efficiency and complexity you have to meet.

1 Like

I think it’s ready to get tested now. Anyone interested in beta testing ?

Hi @mstormi

Looks very interesting, looking quite some time for a weather/pv forecasting system for consuming your own electricity.

That being said, i’m not sure if i’m the right person because i don’t own a EV or a battery. But i’ve 3 heat pumps, dishwasher and washing machine which can be remotely controlled and a PV system off course.

I have a battery so covered that part but I’m interested to know how well it works without a battery, too.
I’d like to know if it works, how much integration work it requires and what you think needs to be documented.
You should be somewhat proficient in OH and preferrably able to understand rules DSL so you can at least do some debugging / analysis if things don’t work the way they should.
Comments and variable names are in German, hope that’s not a problem to understand for you ?
Send me a private message if you want to proceed. Note the code is copyrighted and may not be passed on to anybody.

Yes, please! My devices are already in like PV + Battery, EV, HVAC and some white goods.

I already developed a forecast which fits quite fine to my production curve, battery capacities are shown, and I´m now defining some events in order to trigger some rules

Would be nice to see yor approach.

If you want, you can send me a link for betatesting too, I am doing my master thesis on the subject and would love a second code to compare!

Maybe I can also help testing.
Currently integrated in my OH:

  • Solarlog PV panels
  • Tesla car (charging data)
  • Digital meter (Fluvius)
  • Alfen EV Charger (not yet integrated => need Energy Management system like yours)
  • Heatpump (General)
  • Water heater (relais)

So in short, just missing the brains to control everything

If anyone is interested, my Energy Management System is on sale now see Energie Managen: Effektiv & Flexibel » (German website only, use a translator in case).
It’s moderately priced at less than 300 €, ready to run with Sungrow and Kostal inverters and prepared for some more. Many wallboxes supported.
There’s a demo version to install on a RPi. It’s essentially complete but without the active management part. You can get it at Die Installation Der Smart House Software »


Hallo Markus!

Congrats for your proceedings! Did you make your custon openHAB-based energy management system alone or in team? I am interested in this because I would like to create some similar thing and I would like to know how long does it take when i have already some experience with openhab and i would do it alone. Thank you.

It took a couple of months (not full time of course) and in a team it would have even been more as in that you will have a lot of coordination efforts in addition. You must not underestimate those efforts that arise in professional SW development in teams especially when it comes to tasks like debugging and documentation.

Meanwhile the energy management system has matured.
Some openHAB fellows successfully run it with Sungrow and Kostal inverters.

I’ve expanded the system’s capabilities and integrated EVCC, too.
That now allows for charging EVs with excess power with almost any wallbox on the market.
There’s also new features such as to control arbitrary consumers based on excess power availability.
If you want to check it out then just install the demo, the links above are still valid.

I’m now looking to extend support coverage to more inverter models so to anyone with a SMA, SolarEdge, Fronius or other inverter and ideally a battery, too:
If you’re seriously interested in operating such an EM system and willing to help with beta testing, please get in touch with me.
Please be prepared to provide a dedicated Raspi for the EMS OH instance.

PS anyone with a Tesla and a wallbox that cannot limit charge power ?

1 Like

Here we go: World Smart Home Awards - winner

Congratulations and Well done,
seems very interesting and I will definitly take a clooser look.
Br Basse