How does a thermostat keep a room warm?
You set the thermostat (teal) to 22°. The room is at 18°. You never say “heat for 40 minutes”; you only say the temperature you want. At the top: Wanted 22, Actual 18, and Difference = wanted − actual = 4. While there is a difference, the heater (amber) is on.
Diagram
Thermostat: want 22°, now 18°. The heater is on and a line runs from the thermostat to it.