The internal mass of a building can provide flexibility capacities which can contribute to maintain the grid stability, to reduce peak demand, to avoid investments in grid infrastructure reinforcement and construction of costly power plants [1], [2]. In this context we investigate optimal control of the HVAC system (Heating Ventilation and Air Conditioning) for integration in DR (Demand Response) programs that encourage consumers energy flexibility. Many complex modelling approaches exist in the literature, requiring a lot of building data. In order to design a scalable and easily implemetable solution, we propose a method that relies on data from commonly available sensors and is designed to achieve load control by day-ahead optimal scheduling of temperature setpoints.