🧠 Smart Thermostat (Radiator)

Smart Thermostat

Based on your window / door sensor this automation turns the thermostat on or off.
You can also specify a delay that is needed to switch the state.
In order to avoid heating in summer, you can specify the weather entity and your “wintermode” temperature to turn it off.

The Delay can be individually set, so you can set a higher delay for example for a door. (So it doesn’t turn off your thermostat, when only opening the door for a minute)

You can specify up to 4 enitites, if you have less than 4 just simply duplicate the entries.
(I’m not sure at this point if there is a better solution).

Be aware the on/off switching based on the current outside temperature triggers only as often your weather entity updates!

Please feel free to enhance this take of mine.

blueprint:
  name: Smart Thermostat
  description: >-
    Based on your window sensor this automation turns the thermostat on or off.
    You can also specify the time that is needed to switch the state. 
    In order to avoid heating in summer, you can specify the weather entity and your winter temperature.
    Read more: https://community.home-assistant.io/t/smart-thermostat/258368
  domain: automation
  input:
    window_sensor_1:
      name: Window / Door Sensor 1
      selector:
        entity:
          domain: binary_sensor
    window_1_delay:
      name: Window / Door Sensor 1 Delay
      description: "Time the sensor needs to stay the same after change to trigger the automation. This is done to avoid retriggering. (Default = 5s)"
      default: 5
      selector:
        number:
          mode: box
          min: 0
          max: 3600
          unit_of_measurement: seconds
    window_sensor_2:
      name: Window / Door Sensor 2
      selector:
        entity:
          domain: binary_sensor
    window_2_delay:
      name: Window / Door Sensor 2 Delay
      default: 5
      selector:
        number:
          mode: box
          min: 0
          max: 3600
          unit_of_measurement: seconds
    window_sensor_3:
      name: Window / Door Sensor 3
      selector:
        entity:
          domain: binary_sensor
    window_3_delay:
      name: Window / Door Sensor 3 Delay
      default: 5
      selector:
        number:
          mode: box
          min: 0
          max: 3600
          unit_of_measurement: seconds
    window_sensor_4:
      name: Window / Door Sensor 4
      selector:
        entity:
          domain: binary_sensor
    window_4_delay:
      name: Window / Door Sensor 4 Delay
      default: 5
      selector:
        number:
          mode: box
          min: 0
          max: 3600
          unit_of_measurement: seconds
    weather:
      name: Weather
      description: "Specify your weather to get the current outside temperature from."
      selector:
        entity:
          domain: weather
    wintermode:
      name: Wintermode
      description: "The ouside temperature needs to be below this to activate wintermode. (Default = 16°C)"
      default: 16
      selector:
        number:
          step: 0.5
          min: 0
          max: 150
          unit_of_measurement: "°C or °F"
    wintermode_delay:
      name: Wintermode Delay
      description: "Time the outside temperature neeeds to stay above the wintermode temperature to turn the heating off."
      default: 30
      selector:
        number:
          mode: box
          min: 1
          max: 86400
          unit_of_measurement: minutes
    thermostat:
      name: Thermostat
      selector:
        entity:
          domain: climate
trigger:
  - platform: state
    entity_id: !input window_sensor_1
    to: 'off'
    from: 'on'
    for: !input window_1_delay
  - platform: state
    entity_id: !input window_sensor_1
    to: 'on'
    from: 'off'
    for: !input window_1_delay
  - platform: state
    entity_id: !input window_sensor_2
    to: 'off'
    from: 'on'
    for: !input window_2_delay
  - platform: state
    entity_id: !input window_sensor_2
    to: 'on'
    from: 'off'
    for: !input window_2_delay
  - platform: state
    entity_id: !input window_sensor_3
    to: 'off'
    from: 'on'
    for: !input window_3_delay
  - platform: state
    entity_id: !input window_sensor_3
    to: 'on'
    from: 'off'
    for: !input window_3_delay
  - platform: state
    entity_id: !input window_sensor_4
    to: 'off'
    from: 'on'
    for: !input window_4_delay
  - platform: state
    entity_id: !input window_sensor_4
    to: 'on'
    from: 'off'
    for: !input window_4_delay
  - platform: numeric_state
    entity_id: !input weather
    attribute: temperature
    below: !input wintermode
    for: !input wintermode_delay
  - platform: numeric_state
    entity_id: !input weather
    attribute: temperature
    above: !input wintermode
    for: !input wintermode_delay
action:
  - choose:
      - conditions:
          - condition: and
            conditions:
              - condition: state
                entity_id: !input window_sensor_1
                state: 'off'
              - condition: state
                entity_id: !input window_sensor_2
                state: 'off'
              - condition: state
                entity_id: !input window_sensor_3
                state: 'off'
              - condition: state
                entity_id: !input window_sensor_4
                state: 'off'
              - condition: numeric_state
                entity_id: !input weather
                attribute: temperature
                below: !input wintermode
        sequence:
          - service: climate.set_hvac_mode
            data:
              hvac_mode: heat
            entity_id: !input thermostat
      - conditions:
          - condition: or
            conditions:
              - condition: state
                entity_id: !input window_sensor_1
                state: 'on'
              - condition: state
                entity_id: !input window_sensor_2
                state: 'on'
              - condition: state
                entity_id: !input window_sensor_3
                state: 'on'
              - condition: state
                entity_id: !input window_sensor_4
                state: 'on'
              - condition: numeric_state
                entity_id: !input weather
                attribute: temperature
                above: !input wintermode
        sequence:
          - service: climate.set_hvac_mode
            data:
              hvac_mode: 'off'
            entity_id: !input thermostat
    default: []
2 Likes

how would one specify the temperature that the thermostat should want to heat to?