This PhD dissertation concerns the power management in buildings. The problem of power management is modeled as a mixed linear program. The work presented in this thesis aims to take into account the uncertainties in the optimization of energy flow in the buildings. The uncertainties are analyzed and two types of uncertainty are identified: parametric uncertainties concerning the vagueness of the parameters (weather forecasts, energy demand forecast ...) and the occurrence uncertainties that are related to uncontrollable actions of the user. A robust optimization approach based on a formulation presented by Bertsimas and Sim for robust linear programming is proposed to take into account the parametric uncertainties. An optimization procedure in two stages, based on stochastic programming, is proposed to answer the occurrence uncertainties. This procedure allows to take into account the energy consumption that is not driven by the management system. The proposed methods have been illustrated on various examples of dwellings. Different energy pricing are addressed.