What a thermostat does?
A thermostat in general, is an assembly that measures
temperature (if it measures room temperature then we are talking
about a room thermostat) and trips an electrical contact on and off
comparing measured temperature to a temperature setpoint (the
temperature setting we set on the thermostat by means of a rotating
knob or a digital screen and buttons.
In an hvac system, we install a thermostat inside the room in
which we want to control temperature and we set the desired
temperature.
If current temperature is below setpoint, then the contact
trips, and the heating system heats the room. When measured
temperature reaches the desired setpoint, thermostat trips off and
the heating system will stop giving energy to the room. By starting
and stoping the heating system, we achieve to set room temperature
within some limits.