Skip to content
Programmable thermostat that let you have a smart thermostat on budget.
Branch: master
Clone or download
MapoDan Merge pull request #12 from tubededentifrice/fix-8
Fix issue 8 (AttributeError: 'str' object has no attribute 'state')
Latest commit d1d8207 Jan 18, 2020
Type Name Latest commit message Commit time
Failed to load latest commit information.
custom_components/programmable_thermostat Update Jan 18, 2020
LICENSE Initial commit Mar 3, 2019 Update Jan 4, 2020
resources.json Create resources.json Jan 4, 2020


This component is a revision of the official Home Assistant component 'Generic Thermostat' in order to have possibility to have target temperature variable according to a sensor state value.


Just copy paste the content of the climate.programmable_thermostat/custom_components folder in your config/custom_components directory.

As example you will get the '.py' file in the following path: /config/custom_components/programmable_thermostat/

Note: you can install through HACS.


Here below the example of setup of sensor and parameters to configure.

  - platform: programmable_thermostat
    name: room
      - switch.riscaldamento_1
      - switch.riscaldamento_2
    cooler: switch.condizionamento
    actual_temp_sensor: sensor.target_temperature
    min_temp: 10
    max_temp: 30
    target_temp_sensor: sensor.program_temperature
    tolerance: 0.3
    related_climate: climate.room_2
Field Value Necessity Comments
platform programmable_thermostat Required
name Programmable Thermostat Optional
heater Conditional Switch that will activate/deactivate the heating system. This can be a single entity or a list of entities. At least one between heater and cooler has to be defined.
cooler Conditional Switch that will activate/deactivate the cooling system. This can be a single entity or a list of entities. At least one between heater and cooler has to be defined.
actual_temp_sensor Required Sensor of actual room temperature.
min_temp 5 Optional Minimum temperature manually selectable.
max_temp 40 Optional Maximum temperature manually selectable.
target_temp_sensor Required Sensor that rapresent the desired temperature for the room. Suggestion: use my file_restore compontent or something similar.
tolerance 0.5 Optional Tolerance for turn on and off the switches mode.
initial_hvac_mode heat, cool, off Optional If not set, components will restore old state after restart. I suggest to not use it.
related_climate Optional To be used if the climate object is a slave of an other one. below 'Related climate' chapter a description.



target_temp_sensor is the Home Assistant entity_id of a sensor which state change accrodingly a specified temperature profile. This temperature profile should described the desired temperature for the room each day/hour. target_temp_sensor must have a temperature value (number with or without decimal) as state.

Suggestion: use my file_restore custom components.


Programmed temperature will change accordingly to the one set by the target_temp_sensor, this will not happen if the mode is set to heat_cool. (it is the old manual mode that has been removed from the climate component) In heat and cool modes you can still change manually the temperature for the room, but in this case the target temperature will be set, again, to the one of target_temp_sensor at its first change.

heat and cool modes rapresent the automatic mode.

After a restart of Home Assistant, room temperature e planned room temperature will match till actual_temp_sensor will return a temperature value. This is done to avoid possible issues with Homekit support with temperature sensor that need some time to sync with Home Assistant.


This field is used if the climate 2 climate object are related each other, for example if they used the same heater. Set this field with the entity_id with a different climate object and this will prevent the heater/cooler to be turned off by the slavery climate if the master one is active.

For example I have 2 climate objects, one for the room and one for the boiler. Boiler's climate is used to prevent freezing and, if the temperature is lower the the programmed one, room heater is turned on. This means that, if the room's heater is on and boiler's heater is off, boiler will turn off the heater despite the room one. With this master_climate field this unwanted turn off will not happen.

Note: my suggestion is to set it to both climates that are related each other.


This component has been developed for the bigger project of building a smart thermostat using Home Assistant and way cheeper then the commercial ones. You can find more info on that here

Everything is available through HACS.


You can’t perform that action at this time.