This work presents a data-intensive solution to predict heating and hot water consumption. The ability to predict locally those flexible sources considering meteorological uncertainty can play a key role in the management of microgrid. A microgrid is a building block of future smart grid, it can be defined as a network of low voltage power generating units, storage devices and loads. The main novelties of our approach is to provide an easy implemented and flexible solution which used supervised learning techniques. This paper presents an industrial methodology to predict heating and hot water consumption using time series analyzes and tree ensemble algorithm. Considering the winter season 2012-2013 for the training, the heating and hotwater predictions is correctly estimated 90% +/- 1.2 for the winter season 2013-2014. The results are based on the data collected in a building in Chamoson (Switzerland) and simulations. The aim is to provide to the virtual power plant the possibility to pilot an part of energy consumption. The input data for the pilot is the economic parameter. Considering the economic input data for the energy management, a new heasting and hot water consumption is provided for one week.