In a previous project , a heuristic control algorithm has been developed to find optimal management of the system including : Photovoltaic panels + Inverter + Grid Connection + House Loads + Heat Pump + Domestic Hot Water Tank + Domestic Hot Water demand on a household scale. The aim was to increase the photovoltaic selfconsumption while minimizing the operating expenditures. During this master thesis the optimal control algorithm has been completed and enhanced. Firstly, it has been extended to house heating purposes, then sensitivity to many new parameters has been studied : thermal characteristics of the building, environmental parameters and resiliency to uncertain forecast of weather and consumptions (hot water and electricity). Besides these additions, a new structure of control algorithm has been proposed. Based on the estimation of an indicator, it has proven to be more effective than the previous one, in terms of computation time and running costs. This new control method has been applied to the domestic hot water and the building space heating needs. So the relevance of this new algorithm has been verified by comparison with an already validated heuristic algorithm but also by comparison with MILP optimization. With a system management using this indicator based operation and an appropriate instantaneous control, the overall system shows very good resiliency to uncertain forecast.