Monitoring the thermal comfort of building occupants is crucial for ensuring sustainable and efficient energy consumption in residential buildings. It enables not only remote real-time detection of situations, but also a timely reaction to reduce the damage made by harmful situations in targeted buildings. In this paper, we first design a new Internet of Things (IoT) architecture in order to provide remote availability of both indoor and outdoor conditions, with respect to the limited energy of IoT devices. We then build a multi-output prediction model of indoor parameters using a random forest learning algorithm, and based on a longitudinal real dataset of one year. Our prediction model considers outdoor conditions to predict the indoor ones. Hence, it helps to detect discomfort situations in real-time when comparing predicted variables to real ones. Furthermore, when detecting an indoor thermal discomfort, we provide a new genetic-based algorithm to find the most suitable values of indoor parameters, enabling the improvement of the indoor occupants’ thermal comfort. Numerical results show the efficiency of our prediction scheme, reaching an accuracy of 96%, as well as our genetic-based scheme in optimizing the indoor thermal parameters by 85%.