A thermostat is a temperature sensor that is found in many common electrical devices, such as ovens, heaters, refrigerators and air conditioners, hot water urns, and boilers. Many different types of thermostats exist, but we will only discuss the technological principles relevant for the halacha of Shabbat. Two main types of thermostats exist: mechanical and electrical.
A mechanical thermostat has two main parts: a temperature sensor and an electric switch. The mechanical sensor is a material (or a gas inside a tube) whose area (or volume) changes as the temperature changes. This sensor is placed in contact with the object of interest (an open space in the room or the refrigerator, etc). Expansion of the material causes the detector to curl (because of its construction or because it is made of two metal strips with different expansion coefficients) or press on a diaphragm (with a spring mechanism), thus closing or opening an electric circuit.
In an electrical thermostat, the detector is made of material whose electrical resistance depends on the temperature. The strength of the current flowing through this detector is translated into an exact temperature. Set points are established for the circuit (depending on the temperature) to turn an accompanying device on or off, as desired. An electronic thermostat is much more accurate than a mechanical one, and it can also measure the temperature accurately and display it at all times (as opposed to a mechanical thermostat, which does not have a value for the current temperature and only "knows" whether it is higher than the set point or not).
A device that has a thermostat might present halachic problems on Shabbat. For example, opening the door of a refrigerator allows "warm" air from the outside to enter the refrigerator, and this might cause the thermostat to turn the motor on more quickly than it would have otherwise done. Opening the door of an oven will let "cold" air in, which might cause the heat to be turned on (assuming the heating element is controlled by a thermostat). From the halachic point of view, there is a difference which depends on the type of action performed by a person – is it direct or indirect (see refrigerator, mini-bar), and also how much the person desires the resulting action (see pesik raishai - an inevitable result - in the case when the person does not want the outcome). It is also important to note that opening a window in a home with air conditioning indirectly influences any heating or cooling that is under the control of a thermostat. However, the fact that the system "knows" the accurate temperature (where there is an electrical thermostat) does not present a halachic problem as long as the critical point where an electric circuit is opened or closed has not been reached, since this is a case of changing the level of current, which is permitted on Shabbat for essential needs (and all the more so in a case of pesik raishai). Of course, it is necessary to avoid some electrical systems which provide a physical output as a result of changes (for instance, to a digital display device).
In order to bypass the action of the thermostat in various devices, the engineers of The Zomet Institute have developed a mechanism of "continuing the existing situation." (This is only when necessary from the halachic point of view, such as for institutional space heating or a mini-bar. The Zomet Institute does not install such devices in home refrigerators!) The mechanism turns the equipment on for a few seconds every few minutes, and at the same time it checks the status of the thermostat. If the setpoint was reached after the last check, the equipment will continue running for as long as needed. Note that this solution is only applicable to equipment with a mechanical thermostat and not an electrical one! (If the equipment continuously displays the temperature on a digital display, it almost certainly has an electrical thermostat.)