The reduction of the environmental impact of buildings through better energy management could play a significant role in achieving nowadays greenhouse gas emission reduction targets. In this context and following this purpose, we developed a regulation algorithm to manage the global energy resources of buildings. The control approach optimizes the coupling between local renewable energy production systems (e.g. thermal and photovoltaic solar panels) and energy storage devices (e.g. cold and hot water storage tanks, electrical battery). The innovative aspect of this project compared to standard regulations is the simultaneous optimization of three criteria: the consumption of external energy resources, the costs and the ecological impact. In this paper we present and analyse the implementation of this regulation based on the ecological criterion. A genetic optimization is performed according to a score function evaluating the ecological impact based on the CO2 equivalent production. In order to improve the strategy, the regulation predicts the future energy demand and production. The genetic algorithm approach is used due to the large amount of optimization variables and the non-linearity of the score function. This genetic optimization algorithm uses real time data like building physical data (e.g. internal temperature) and prediction based on the user’s habits and weather information to define the best energy strategy. It insures the electrical and thermal energy demand while optimizing the ecological criterion. To demonstrate the algorithm performances, the regulation was implemented and tested with an independent simulation environment. The ecological impact of the genetic algorithm regulation over one week is then compared to the greenhouse gas emission from a standard regulation. With this setting, a reduction of 29 kg equivalent CO2 was realized, which shows the enormous potential of the new regulation approach.