One of the factors determining comfort in buildings is the indoor air temperature of the rooms. A control system, part of the home automation system, should stabilise air temperature to the desired level, despite various disturbances such as the presence of random or occasional sources of heat. Inaccurate models of the dynamics of air temperature changes in buildings prescribe the use of robust control methods, a type of which is the sliding mode controller. This article presents the application of a sliding mode controller (SMC) to home automation systems, designed to control air temperature inside a building. The sliding-mode controller makes use of sliding surfaces, which are defined by the assumed trajectory and the system output. The control law is designed in such a way that the trajectory of the system tends to the sliding surface from any initial point and remains on it after reaching the sliding surface. In this article, a model at air temperature change dynamics inside a building is presented. The modelling approach relies on the lumped-parameter methodology, in which distributed physical properties are represented by lumped parameters (such as thermal capacity or resistance). The model takes into account the loss of heat through conduction and ventilation, as well as internal heat gain. The parameters of the model can be obtained easily from the thermal properties of the construction materials. Theoretical considerations were applied in simulation experiments and the results of these experiments confirm the performance improvement achieved by the proposed solutions.