The optimization of the thermal performance of passive elements inside buildings is not always obtained, due to fluctuations of the weather conditions and internal generation. This work aims to improve the energy behavior of a building under the meteorological conditions of Fez, through a system internet of things called IOT, allow to communicate and interact with other devices, exchange data, in order to manage all the elements affecting the building namely the passive, active and consumer behavior.