The objective of this paper is to analyze the value of energy replacement in the context of demand response. Energy replacement is defined as the possibility of the consumer to choose the most convenient source for providing space heating to a smart building according to a dynamic electricity price. In the proposed setup, heat is provided by conventional electric radiators and a combined heat and power generation system, composed by a fuel cell and an electrolyzer. The energy replacement strategy is formulated using model predictive control and mathematical models of the components involved. Simulations show that the predictive energy replacement strategy reduces the operating costs of the system and is able to provide a larger amount of regulating power to the grid. In the paper, we also develop a novel dynamic model of a PEM fuel cell suitable for micro-grid applications. The model is realized applying a grey-box methodology to the experimental proton exchange membrane fuel cell of the EPFL–DESL micro-grid.