Platform Home Assistant "Generic Thermostat" (generic thermostat)

3 minutes of reading
Proconductor: Home Assistant Community
Availability: included in thepersonale HUB Home Assistant
Category: software
Type: platform Home Assistant
Family: component "Climate” Home Assistant
Implementation difficulties: low
Card revision: 1.1

The "Generic Thermostat" platform it is useful to define at the configuration of Home Assistant a generic type thermostat, or not bound to no specific technology. Differently from other platforms (eg. "MQTT HVAC"), Aentity created using this platform it "limits" itself to activate / deactivate a switch (a switch) - previously defined in the configuration - after exceeding a user-defined thermal threshold in relation to the room temperature, detected by a sensor thermal - also previously defined in the configuration.

Obviously, this switch will have to somehow perform, against the profirst activation / deactivation, the consequent action towards some plant of proheat production. But we get there.

This generic thermostat is able to manage switches that control activation of heating or cooling systems: the configuration parameters of this platform allow to manage both of these types of thermal units. However, it is not possible to simultaneously control multiple switches: each entity defined through this platform controls only one switch at a time.

In case of heating systems the entity activates the switch in the event of the room temperature is inferior to that target set by the user; vice versa, in the case of cooling unit the switch indicated in the configuration is activated when the room temperature is greater of that target.

An example of use of this excellent platform is in prodomotization jet of an independent heating system with the help of a actuator Sonoff Basic modified.


To create aentity "Climate”(Climate) via this platform the block to be inserted at the configuration "configuration.yaml" di Home Assistant it is basically similar to the following:

  - platform: generic_thermostat
    name: Riscaldamento
    heater: switch.riscaldamento_sala
    target_sensor: sensor.temperatura_sala

Where the procustomization property I'm:

name(string, optional) - The name of the entity.
heater(string, mandatory) - The name of the switch entity (switch) to be checked. Become an "air conditioning" switch when the field "ac_mode"Is set to"true"
target_sensor(string, mandatory) - The name of the sensor (sensor) from which to draw the temperature value of the environment in which the climate system is inserted.
min_temp / max_temp(full, optional) - The temperature range in which the thermostat works. Default: 7 / 35
target_temp(integer, optional) - The default target temperature when starting Home Assistant.
ac_mode(Boolean, optional) - Set to "false" it assigns the role of heating to the entity, to "true" the role of cooling.
min_cycle_duration(internal, optional) - Time for which the switch must spend in a given state (on / off) before receiving a change of status from the entity. It must contain at least one of these entries: "days: ","hours: ","minutes: ","seconds: ","milliseconds".
cold_tolerance(decimal, optional) - Number indicating the tolerance on the target temperature in case of proheat production. If for example it is set to 0.5 and the target temperature is 25 degrees, the switch is activated at a temperature below 24.5 degrees.
hot_tolerance(decimal, optional) - Number indicating the tolerance on the target temperature in case of procold production. If for example it is set to 0.5 and the target temperature is 25 degrees, the switch is activated at a temperature above 25.5 degrees.
keep_alive(full, optional) - Some devices need the repetition of the start command every tot. By setting this parameter, you indicate how often to keep this behavior. It must contain at least one of these entries: "days: ","hours: ","minutes: ","seconds: ","milliseconds".
initial_hvac_mode(optional) - Initial operating mode. Could be "off"Or"auto"
away_temp(whole, optional) Indicates the target temperature to be set in away mode with the thermostat on ("auto" mode). Useful in case of automation linked to the presence / absence of tenants.

An example of complete configuration is the following:

  - platform: generic_thermostat
    heater: switch.riscaldamento_sala
    target_sensor: sensor.temperatura_sala
    min_temp: 15
    max_temp: 21
    ac_mode: False
    target_temp: 17
    cold_tolerance: 0.3
    hot_tolerance: 0
      seconds: 5
      minutes: 3
    initial_hvac_mode: "off"
    away_temp: 16


This platform has been successfully implemented in a proad hoc jet aimed at domotizing a heating system through Sonoff Basic and without a physical thermostat.

Home Assistant Official LogoATTENZIONE: remember that there is on our FORUM community an ad hoc section dedicated to Home Assistant, for any doubt, question, information on the specific merit of these components.

inDomus telegram channel