The objective of this paper is to present a generic middleware conceived to operate as the linking element in platforms hosting smart energy management services to reduce energy consumption in buildings. This kind of solution presents specific requirements related to the need of accessing and managing different sources of information, internal and external to the building, and related to its structure, geometry, or energy consumption. This information is then processed by the system to determine how to improve the energy behavior of the building. In this context, different elements, communicating in a different way and speaking different languages, have to inter-operate with each other to reach the common objective of reducing the energy consumption by executing integrated energy management actions. With the aim of making this system interoperable, coherent, easily expandable, and transparent, the proposed middleware provides a homogeneous level of abstraction in this heterogeneous scenario.