Automated temperature control (target temperature sensor, door/window, heat-once)

hey Pulsaro,
it is just a template - binary_sensor give you ‘on’ or ‘off’ if you ar above or below the goal temperature. In my case it looks like:

binary_sensor:
  - platform: template
      kinderzimmer_above_goal_t:
        friendly_name: "Kinderzimmer: T > T_goal"
        value_template: >-
          {{ states('sensor.kinderzimmer_t') | float > state_attr('climate.kinderzimmer_thermostat', 'temperature') |float }}
      kinderzimmer_below_goal_t:
        friendly_name: "Kinderzimmer: T < T_goal-dT"
        value_template: >-
          {{ states('sensor.kinderzimmer_t') | float < (state_attr('climate.kinderzimmer_thermostat', 'temperature') |float - states('input_number.system_delta_goal_t') | float) }}
1 Like

thank you!

With trigger-id it is much easier to implement.
Here the simplified version of the blueprint. I’ve deleted “heat-ones”, since I haven’t use it during the last winter at all.

blueprint:
  name: Heizungssteuerung
  domain: automation
  input:
    climate_target:
      name: Thermostat
      description: Thermostat to be controlled
      selector:
        entity:
          domain: climate
    t_current_target:
      name: T_curr
      description: Current temperature in room.
      selector:
        entity:
          domain: sensor
    climate_trigger_t_above:
      name: Flag T > T_goal
      description: Flag, it the temperature T above T_goal
      selector:
        entity:
          domain: binary_sensor
    climate_trigger_t_below:
      name: Flag T < T_goal - T_delta
      description: Flag, it the temperature T below T_goal - T_delta
      selector:
        entity:
          domain: binary_sensor
    open_close_target:
      name: Door | Window - group
      description: Group of sensors for switching off the climate in "on"-state
      selector:
        entity:
          domain: group
    climate_auto_control_target:
      name: Manual switch for climate 
      description: Flag for activating / deactivating of climate control
      selector:
        entity:
          domain: input_boolean
mode: queued

variables:
  climate_target: !input climate_target
  t_current_target: !input t_current_target
  open_close_target: !input open_close_target
  climate_auto_control_target: !input climate_auto_control_target
  climate_trigger_t_above: !input climate_trigger_t_above
  climate_trigger_t_below: !input climate_trigger_t_below

  t_goal: "{{state_attr(climate_target, 'temperature') | float}}"
  t_current: "{{states[t_current_target].state | float}}"

  debug_mode: 'off'
  
trigger:
  - platform: state
    entity_id: !input open_close_target
    for: 00:00:45
    from: 'off'
    to: 'on'
    id: trigger_open
  - platform: state
    entity_id: !input open_close_target
    from: 'on'
    to: 'off'
    id: trigger_close
  - platform: state
    entity_id: !input climate_auto_control_target
    from: 'on'
    to: 'off'
    id: trigger_steuerung_off
  - platform: state
    entity_id: !input climate_auto_control_target
    from: 'off'
    to: 'on'
    id: trigger_steuerung_on
  - platform: state
    entity_id: !input climate_trigger_t_above
    to: 'on'
    from: 'off'
    id: trigger_t_above
  - platform: state
    entity_id: !input climate_trigger_t_below
    to: 'on'
    from: 'off'
    id: trigger_t_below
  - platform: state
    entity_id: !input climate_target
    to: heat
    id: climate_to_heat
  - platform: state
    entity_id: !input climate_target
    to: auto
    id: climate_to_auto

condition: []

action:
  - choose:
###############################################################################
###############################################################################
    - conditions:
      - condition: trigger
        id: trigger_steuerung_off
      sequence:
      #  hold_temperature on to off -> check climate on
      - choose:
        - conditions: # check if on or auto
          - condition: not
            conditions:
            - condition: state
              entity_id: !input climate_target
              state: 'off'
          sequence:
          #  climate on -> turn off
          - service: climate.turn_off
            data: {}
            entity_id: !input climate_target
        default: [] #  climate off -> continue
###############################################################################
###############################################################################
    - conditions:
      - condition: trigger
        id: trigger_steuerung_on
      sequence:
      #  Called by hold_temperature
      #  hold_temperature off to on -> check if t < goal
      - choose:
        - conditions:
          - condition: template
            value_template: '{{ t_current  < t_goal }}'
          sequence:
          #  t < goal is true -> check if heat on
          - choose:
            - conditions:
              - condition: state
                entity_id: !input climate_target
                state: 'off'
              sequence:
              #  climate off -> turn climate to heat mode
              - service: climate.set_hvac_mode
                data:
                  hvac_mode: heat
                entity_id: !input climate_target
            default: [] # climate already on -> continue
        default: [] # t < goal is false -> continue
###############################################################################
###############################################################################
    - conditions:
      - condition: trigger
        id: trigger_open
      sequence:
      # door/window open -> check hold_temperature
      - choose:
        - conditions:
          - condition: state
            entity_id: !input climate_auto_control_target
            state: 'on'
          sequence:
          #  hold_temperature on -> turn off hold_temperature
          - service: input_boolean.turn_off
            data: {}
            entity_id: !input climate_auto_control_target
        default:
        # hold_temperature off -> check climate on
        - choose:
          - conditions:
            - condition: not
              conditions:
              - condition: state
                entity_id: !input climate_target
                state: 'off'
            sequence:
            #  climate on -> turn off
            - service: climate.turn_off
              data: {}
              entity_id: !input climate_target
          default: [] #climate already off -> continue
###############################################################################
###############################################################################
    - conditions:
      - condition: trigger
        id: trigger_close
      sequence:
      # door/window closed -> check hold_temperature
      - choose:
        - conditions:
          - condition: state
            entity_id: !input climate_auto_control_target
            state: 'off'
          sequence:
          # hold_temperature off -> turn hold_temperature on
          - service: input_boolean.turn_on
            data: {}
            entity_id: !input climate_auto_control_target
        default: [] # hold_temperature on -> continue
###############################################################################
###############################################################################
    - conditions:
      - condition: trigger
        id: climate_to_auto
      #  '"climate auto -> 'heat' or 'off'"' 
      sequence:
      - choose:
        - conditions:
          - condition: template
            value_template: '{{ t_current  < t_goal }}'
          sequence:
          - service: climate.set_hvac_mode
            data:
              hvac_mode: heat
            entity_id: !input climate_target
        default: 
        - service: climate.set_hvac_mode
          data:
            hvac_mode: 'off'
          entity_id: !input climate_target
###############################################################################
###############################################################################
    - conditions:
      - condition: trigger
        id: climate_to_heat
      sequence:
      #  climate to heat -> check if hold_temperature is on
      - choose:
        - conditions:
          - condition: state
            entity_id: !input climate_auto_control_target
            state: 'off'
          sequence:
          # 'by climate on to heat: hold_temperature off -> turn on'
          - service: input_boolean.turn_on
            data: {}
            entity_id: !input climate_auto_control_target
        default: [] #  'by climate on to heat: hold_temperature on -> continue'
###############################################################################
###############################################################################
    - conditions:
      - condition: trigger
        id: trigger_t_above
      sequence:
      #  '"T > goal is true -> turn off climate"'
      - choose:
        - conditions: # check if on or auto
          - condition: not
            conditions:
            - condition: state
              entity_id: !input climate_target
              state: 'off'
          sequence:
          - service: climate.turn_off
            data: {}
            entity_id: !input climate_target 
        default: [] #  continue
###############################################################################
###############################################################################
    - conditions:
      - condition: trigger
        id: trigger_t_below
      sequence:
      #  T < goal - d for sensor or T < goal for climate is true -> check if heat on
      - choose:
        - conditions:
          - condition: state
            entity_id: !input climate_target
            state: 'off'
          sequence:
          #  climate off -> turn climate to heat
          - service: climate.set_hvac_mode
            data:
              hvac_mode: heat
            entity_id: !input climate_target
        default: [] #  climate already on -> continue
###############################################################################
###############################################################################
    default: []  #  Unknown trigger case
    #  '#### End of automation ####'

Hi,
Now I need your help, I tried the second version now (without Heat Ones).
Now it works sometimes, but sometimes it doesn’t.

I activate AutoHeat, set my temperature and when it gets over it the “below” sensor switches, but the heater is not deactivated.
The second problem is the error message with the binary_sensor, which I created as follows:

# Esszimmer
  - platform: template
    sensors:
      esszimmer_above_goal_t:
        friendly_name: "Esszimmer: T > T_goal"
        value_template: >-
          {{ states('sensor.average_esszimmer') | float > state_attr('climate.heizung_esszimmer', 'temperature') |float }}
  - platform: template
    sensors:
      esszimmer_below_goal_t:
        friendly_name: "Esszimmer: T < T_goal-dT"
        value_template: >-
          {{ states('sensor.average_esszimmer') | float < (state_attr('climate.heizung_esszimmer', 'temperature') |float - states('input_number.t_delta') | float) }}```

and then get this error message.
Can I leave out the “input_number. t_delta”?

Template warning: 'float' got invalid input 'unavailable' when rendering template '{{ states('sensor.average_schlafzimmer') | float < (state_attr('climate.heizung_schlafzimmer', 'temperature') |float - states('input_number.t_delta') | float) }}' but no default was specified. Currently 'float' will return '0', however this template will fail to render in Home Assistant core 2022.1

If I manually activate the automation and the temperature is reached, even then it does not turn off the thermostat:/
I have Fritz thermostats on the heaters, but that shouldn’t be the reason.

1 Like

Of couse, you can replace input_number. t_delta by a constant number (let it be 0.5 or similar).

You can avoid the warning by replacing

states('sensor.average_schlafzimmer') | float

by

float(states('sensor.average_schlafzimmer'), 0)

As long, as your thermostat has the modes “heat”, “off” and auto, it should work.
If it has presets, you can try to set it to “manual”.

Meanwhile I changed the blueprint a little bit, since one of my thermostat is a different one, and set always the temperature to 16°C, if you manually change the temperature (“auto → heat” is disabled now)

The temperature set by automation still works well.

Here is a blueprint, I use to set temperature profile during the day.

blueprint:
  name: Heizungssteuerung
  domain: automation
  input:
    climate_target:
      name: Thermostat
      description: Thermostat to be controlled
      selector:
        entity:
          domain: climate
    t_current_target:
      name: T_curr
      description: Current temperature in room.
      selector:
        entity:
          domain: sensor
    climate_trigger_t_above:
      name: Flag T > T_goal
      description: Flag, it the temperature T above T_goal
      selector:
        entity:
          domain: binary_sensor
    climate_trigger_t_below:
      name: Flag T < T_goal - T_delta
      description: Flag, it the temperature T below T_goal - T_delta
      selector:
        entity:
          domain: binary_sensor
    open_close_target:
      name: Door | Window - group
      description: Group of sensors for switching off the climate in "on"-state
      selector:
        entity:
          domain: group
    climate_auto_control_target:
      name: Manual switch for climate 
      description: Flag for activating / deactivating of climate control
      selector:
        entity:
          domain: input_boolean
mode: queued

variables:
  climate_target: !input climate_target
  t_current_target: !input t_current_target
  open_close_target: !input open_close_target
  climate_auto_control_target: !input climate_auto_control_target
  climate_trigger_t_above: !input climate_trigger_t_above
  climate_trigger_t_below: !input climate_trigger_t_below

  t_goal: "{{float(state_attr(climate_target, 'temperature'), 0)}}"
  t_current: "{{float(states[t_current_target].state, 0)}}"

  debug_mode: 'off'
  
trigger:
  - platform: state
    entity_id: !input open_close_target
    for: 00:00:45
    from: 'off'
    to: 'on'
    id: trigger_open
  - platform: state
    entity_id: !input open_close_target
    from: 'on'
    to: 'off'
    for: 00:00:10
    id: trigger_close
  - platform: state
    entity_id: !input climate_auto_control_target
    from: 'on'
    to: 'off'
    id: trigger_steuerung_off
  - platform: state
    entity_id: !input climate_auto_control_target
    from: 'off'
    to: 'on'
    id: trigger_steuerung_on
  - platform: state
    entity_id: !input climate_trigger_t_above
    to: 'on'
    from: 'off'
    id: trigger_t_above
  - platform: state
    entity_id: !input climate_trigger_t_below
    to: 'on'
    from: 'off'
    id: trigger_t_below
  - platform: state
    entity_id: !input climate_target
    to: heat
    id: climate_to_heat
#  - platform: state
#    entity_id: !input climate_target
#    to: auto
#    id: climate_to_auto

condition: []

action:
  - choose:
###############################################################################
###############################################################################
    - conditions:
      - condition: trigger
        id: trigger_steuerung_off
      sequence:
      #  hold_temperature on to off -> check climate on
      - choose:
        - conditions: # check if on or auto
          - condition: not
            conditions:
            - condition: state
              entity_id: !input climate_target
              state: 'off'
          sequence:
          #  climate on -> turn off
          - service: climate.turn_off
            entity_id: !input climate_target
        default: [] #  climate off -> continue
###############################################################################
###############################################################################
    - conditions:
      - condition: trigger
        id: trigger_steuerung_on
      sequence:
      #  Called by hold_temperature
      #  hold_temperature off to on -> check if t < goal
      - choose:
        - conditions:
          - condition: template
            value_template: '{{ t_current  < t_goal }}'
          sequence:
          #  t < goal is true -> check if heat on
          - choose:
            - conditions:
              - condition: state
                entity_id: !input climate_target
                state: 'off'
              sequence:
              #  climate off -> turn climate to heat mode
              - service: climate.turn_on
                entity_id: !input climate_target 
              - choose:
                - conditions:
                    - condition: not
                      conditions:
                      - condition: state
                        entity_id: !input climate_target
                        state: heat        
                  sequence:
                  #  climate off or auto -> turn climate to heat
                  - service: climate.set_hvac_mode
                    data:
                      hvac_mode: heat
                    entity_id: !input climate_target
                default: [] #  climate already on -> continue
            default: [] # climate already on -> continue
        default: [] # t < goal is false -> continue
###############################################################################
###############################################################################
    - conditions:
      - condition: trigger
        id: trigger_open
      sequence:
      # door/window open -> check hold_temperature
      - choose:
        - conditions:
          - condition: state
            entity_id: !input climate_auto_control_target
            state: 'on'
          sequence:
          #  hold_temperature on -> turn off hold_temperature
          - service: input_boolean.turn_off
            entity_id: !input climate_auto_control_target
        default:
        # hold_temperature off -> check climate on
        - choose:
          - conditions:
            - condition: not
              conditions:
              - condition: state
                entity_id: !input climate_target
                state: 'off'
            sequence:
            #  climate on -> turn off
            - service: climate.turn_off
              entity_id: !input climate_target
          default: [] #climate already off -> continue
###############################################################################
###############################################################################
    - conditions:
      - condition: trigger
        id: trigger_close
      sequence:
      # door/window closed -> check hold_temperature
      - choose:
        - conditions:
          - condition: state
            entity_id: !input climate_auto_control_target
            state: 'off'
          sequence:
          # hold_temperature off -> turn hold_temperature on
          - service: input_boolean.turn_on
            entity_id: !input climate_auto_control_target
        default: [] # hold_temperature on -> continue
###############################################################################
###############################################################################
#    - conditions:
#      - condition: trigger
#        id: climate_to_auto
#      #  '"climate auto -> 'heat' or 'off'"' 
#      sequence:
#      - choose:
#        - conditions:
#          - condition: template
#            value_template: '{{ t_current  < t_goal }}'
#          sequence:
#          #  climate off or auto -> turn climate to heat
#          - service: climate.turn_on
#            entity_id: !input climate_target 
#          - choose:
#            - conditions:
#                - condition: not
#                  conditions:
#                  - condition: state
#                    entity_id: !input climate_target
#                    state: heat        
#              sequence:
#              #  climate off or auto -> turn climate to heat
#              - service: climate.set_hvac_mode
#                data:
#                  hvac_mode: heat
#                entity_id: !input climate_target
#            default: [] #  climate already on -> continue
#        default: 
#            #  climate on -> turn off
#        - service: climate.turn_off
#          entity_id: !input climate_target
###############################################################################
###############################################################################
    - conditions:
      - condition: trigger
        id: climate_to_heat
      sequence:
      #  climate to heat -> check if hold_temperature is on
      - choose:
        - conditions:
          - condition: state
            entity_id: !input climate_auto_control_target
            state: 'off'
          sequence:
          # 'by climate on to heat: hold_temperature off -> turn on'
          - service: input_boolean.turn_on
            entity_id: !input climate_auto_control_target
        default: [] #  'by climate on to heat: hold_temperature on -> continue'
###############################################################################
###############################################################################
    - conditions:
      - condition: trigger
        id: trigger_t_above
      sequence:
    #  '"T > goal is true -> turn off climate"'
      - choose:
        - conditions: # check if on or auto
          - condition: not
            conditions:
            - condition: state
              entity_id: !input climate_target
              state: 'off'
          sequence:
          - service: climate.turn_off
            entity_id: !input climate_target 
        default: [] #  continue
###############################################################################
###############################################################################
    - conditions:
      - condition: trigger
        id: trigger_t_below
      sequence:
      #  T < goal - d for sensor or T < goal for climate is true -> check if heat on
      - choose:
        - conditions:
            - condition: and
              conditions:
              - condition: state
                entity_id: !input climate_auto_control_target
                state: 'on'
              - condition: not
                conditions:
                - condition: state
                  entity_id: !input climate_target
                  state: heat 
          sequence:
          #  climate off or auto -> turn climate to heat
          - service: climate.turn_on
            entity_id: !input climate_target 
          - choose:
            - conditions:
                - condition: not
                  conditions:
                  - condition: state
                    entity_id: !input climate_target
                    state: heat        
              sequence:
              #  climate off or auto -> turn climate to heat
              - service: climate.set_hvac_mode
                data:
                  hvac_mode: heat
                entity_id: !input climate_target
            default: [] #  climate already on -> continue
        default: [] #  climate already on -> continue
###############################################################################
###############################################################################
    default: []  #  Unknown trigger case
    #  '#### End of automation ####'

blueprint:
  name: Heizungssteuerung
  domain: automation
  input:
    climate_target:
      name: Thermostat
      description: Thermostat to be controlled
      selector:
        entity:
          domain: climate
    t_current_target:
      name: T_curr
      description: Current temperature in room.
      selector:
        entity:
          domain: sensor
    climate_trigger_t_above:
      name: Flag T > T_goal
      description: Flag, it the temperature T above T_goal
      selector:
        entity:
          domain: binary_sensor
    climate_trigger_t_below:
      name: Flag T < T_goal - T_delta
      description: Flag, it the temperature T below T_goal - T_delta
      selector:
        entity:
          domain: binary_sensor
    open_close_target:
      name: Door | Window - group
      description: Group of sensors for switching off the climate in "on"-state
      selector:
        entity:
          domain: group
    climate_auto_control_target:
      name: Manual switch for climate 
      description: Flag for activating / deactivating of climate control
      selector:
        entity:
          domain: input_boolean
mode: queued

variables:
  climate_target: !input climate_target
  t_current_target: !input t_current_target
  open_close_target: !input open_close_target
  climate_auto_control_target: !input climate_auto_control_target
  climate_trigger_t_above: !input climate_trigger_t_above
  climate_trigger_t_below: !input climate_trigger_t_below

#  t_goal: "{{float(state_attr(climate_target, 'temperature'), 0)}}"
#  t_current: "{{float(states[t_current_target].state, 0)}}"

  debug_mode: 'off'
  
trigger:
  - platform: state
    entity_id: !input open_close_target
    for: 00:00:45
    from: 'off'
    to: 'on'
    id: trigger_open
  - platform: state
    entity_id: !input open_close_target
    from: 'on'
    to: 'off'
    for: 00:00:10
    id: trigger_close
  - platform: state
    entity_id: !input climate_auto_control_target
    from: 'on'
    to: 'off'
    id: trigger_steuerung_off
  - platform: state
    entity_id: !input climate_auto_control_target
    from: 'off'
    to: 'on'
    id: trigger_steuerung_on
  - platform: state
    entity_id: !input climate_trigger_t_above
    to: 'on'
    from: 'off'
    id: trigger_t_above
  - platform: state
    entity_id: !input climate_trigger_t_below
    to: 'on'
    from: 'off'
    id: trigger_t_below
  - platform: state
    entity_id: !input climate_target
    to: heat
    id: climate_to_heat
#  - platform: state
#    entity_id: !input climate_target
#    to: auto
#    id: climate_to_auto

condition: []

action:
  - choose:
###############################################################################
###############################################################################
    - conditions:
      - condition: trigger
        id: trigger_steuerung_off
      sequence:
      #  hold_temperature on to off -> check climate on
      - choose:
        - conditions: # check if on or auto
          - condition: not
            conditions:
            - condition: state
              entity_id: !input climate_target
              state: 'off'
          sequence:
          #  climate on -> turn off
          - service: climate.turn_off
            entity_id: !input climate_target
        default: [] #  climate off -> continue
###############################################################################
###############################################################################
    - conditions:
      - condition: trigger
        id: trigger_steuerung_on
      sequence:
      #  Called by hold_temperature
      #  hold_temperature off to on -> check if t < goal
      - choose:
        - conditions:
          - condition: state
            entity_id: !input climate_trigger_t_below
            state: 'on'
          sequence:
          #  t < goal is true -> check if heat on
          - choose:
            - conditions:
              - condition: state
                entity_id: !input climate_target
                state: 'off'
              sequence:
              #  climate off -> turn climate to heat mode
              - service: climate.turn_on
                entity_id: !input climate_target 
              - choose:
                - conditions:
                    - condition: not
                      conditions:
                      - condition: state
                        entity_id: !input climate_target
                        state: heat        
                  sequence:
                  #  climate off or auto -> turn climate to heat
                  - service: climate.set_hvac_mode
                    data:
                      hvac_mode: heat
                    entity_id: !input climate_target
                default: [] #  climate already on -> continue
            default: [] # climate already on -> continue
        default: [] # t < goal is false -> continue
###############################################################################
###############################################################################
    - conditions:
      - condition: trigger
        id: trigger_open
      sequence:
      # door/window open -> check hold_temperature
      - choose:
        - conditions:
          - condition: state
            entity_id: !input climate_auto_control_target
            state: 'on'
          sequence:
          #  hold_temperature on -> turn off hold_temperature
          - service: input_boolean.turn_off
            entity_id: !input climate_auto_control_target
        default:
        # hold_temperature off -> check climate on
        - choose:
          - conditions:
            - condition: not
              conditions:
              - condition: state
                entity_id: !input climate_target
                state: 'off'
            sequence:
            #  climate on -> turn off
            - service: climate.turn_off
              entity_id: !input climate_target
          default: [] #climate already off -> continue
###############################################################################
###############################################################################
    - conditions:
      - condition: trigger
        id: trigger_close
      sequence:
      # door/window closed -> check hold_temperature
      - choose:
        - conditions:
          - condition: state
            entity_id: !input climate_auto_control_target
            state: 'off'
          sequence:
          # hold_temperature off -> turn hold_temperature on
          - service: input_boolean.turn_on
            entity_id: !input climate_auto_control_target
        default: [] # hold_temperature on -> continue
###############################################################################
###############################################################################
#    - conditions:
#      - condition: trigger
#        id: climate_to_auto
#      #  '"climate auto -> 'heat' or 'off'"' 
#      sequence:
#      - choose:
#        - conditions:
#          - condition: template
#            value_template: '{{ t_current  < t_goal }}'
#          sequence:
#          #  climate off or auto -> turn climate to heat
#          - service: climate.turn_on
#            entity_id: !input climate_target 
#          - choose:
#            - conditions:
#                - condition: not
#                  conditions:
#                  - condition: state
#                    entity_id: !input climate_target
#                    state: heat        
#              sequence:
#              #  climate off or auto -> turn climate to heat
#              - service: climate.set_hvac_mode
#                data:
#                  hvac_mode: heat
#                entity_id: !input climate_target
#            default: [] #  climate already on -> continue
#        default: 
#            #  climate on -> turn off
#        - service: climate.turn_off
#          entity_id: !input climate_target
###############################################################################
###############################################################################
    - conditions:
      - condition: trigger
        id: climate_to_heat
      sequence:
      #  climate to heat -> check if hold_temperature is on
      - choose:
        - conditions:
          - condition: state
            entity_id: !input climate_auto_control_target
            state: 'off'
          sequence:
          # 'by climate on to heat: hold_temperature off -> turn on'
          - service: input_boolean.turn_on
            entity_id: !input climate_auto_control_target
        default: [] #  'by climate on to heat: hold_temperature on -> continue'
###############################################################################
###############################################################################
    - conditions:
      - condition: trigger
        id: trigger_t_above
      sequence:
    #  '"T > goal is true -> turn off climate"'
      - choose:
        - conditions: # check if on or auto
          - condition: not
            conditions:
            - condition: state
              entity_id: !input climate_target
              state: 'off'
          sequence:
          - service: climate.turn_off
            entity_id: !input climate_target 
        default: [] #  continue
###############################################################################
###############################################################################
    - conditions:
      - condition: trigger
        id: trigger_t_below
      sequence:
      #  T < goal - d for sensor or T < goal for climate is true -> check if heat on
      - choose:
        - conditions:
            - condition: and
              conditions:
              - condition: state
                entity_id: !input climate_auto_control_target
                state: 'on'
              - condition: not
                conditions:
                - condition: state
                  entity_id: !input climate_target
                  state: heat 
          sequence:
          #  climate off or auto -> turn climate to heat
          - service: climate.turn_on
            entity_id: !input climate_target 
          - choose:
            - conditions:
                - condition: not
                  conditions:
                  - condition: state
                    entity_id: !input climate_target
                    state: heat        
              sequence:
              #  climate off or auto -> turn climate to heat
              - service: climate.set_hvac_mode
                data:
                  hvac_mode: heat
                entity_id: !input climate_target
            default: [] #  climate already on -> continue
        default: [] #  climate already on -> continue
###############################################################################
###############################################################################
    default: []  #  Unknown trigger case
    #  '#### End of automation ####'

Ah hab grad gesehen das du ja auch deutsch kannst :).
Du ich hab heute mal die v2 von dir ausprobiert, jetzt hatte ich grad wieder das Problem, das im Esszimmer die Temperatur erreicht wurde → Heizung aus → aber nicht wieder an als es kälter war :&

Nomal sollte das doch bei below Goal wieder an gehen oder nicht?
Deine Thermostat Darstellung gefällt mir, könntest du mir deine config dazu evtl. noch sharen?

thx! :slight_smile:

Aktuell ist es bei mir, am Beispiel für ein Zimmer, so implementiert

      wohnzimmer_above_goal_t:
        friendly_name: "Wohnzimmer: T > T_goal"
        value_template: >-
          {{ float( states('sensor.wohnzimmer_t') , 0) > float( state_attr('climate.wohnzimmer_thermostat', 'temperature') , 0) }}
      wohnzimmer_below_goal_t:
        friendly_name: "Wohnzimmer: T < T_goal-dT"
        value_template: >-
          {{ float( states('sensor.wohnzimmer_t') , 0) < (float( state_attr('climate.wohnzimmer_thermostat', 'temperature') , 0) - float( states('input_number.system_delta_goal_t') , 0)) }}

Du wolltest ja “delta_goal” vermeiden, deswegen müsste es so aussehen (nicht getestet, hier direkt angepasst)

      wohnzimmer_above_goal_t:
        friendly_name: "Wohnzimmer: T > T_goal"
        value_template: >-
          {{ float( states('sensor.wohnzimmer_t') , 0) > float( state_attr('climate.wohnzimmer_thermostat', 'temperature') , 0) }}
      wohnzimmer_below_goal_t:
        friendly_name: "Wohnzimmer: T < T_goal-dT"
        value_template: >-
          {{ float( states('sensor.wohnzimmer_t') , 0) < (float( state_attr('climate.wohnzimmer_thermostat', 'temperature') , 0) - 0.5) }}

sensor.wohnzimmer_t ist die aktuelle Temperatur im Zimmer.

Vergleiche, ob Du genau so es bei Dir hast (z.B. 0.5 und nicht 0,5 u.s.w).

Ich habe da noch eine Version gepostet, da heute irgendwie “template t_current < t_goal” nicht triggern wollte, habe da direkt auf den sensor.t_below umgestellt und Variablen gelöscht.

Also, theoretisch muss es so funktioneren :slight_smile: Vorausgesetzt Deine Thermostate lassen sich steuern.

Was ich gerade feststelle: t_curr (t_current_target) im Blueprint nach der letzten Anpassung obsolet und kann auch gelöscht werden.
Generell gilt: Hier ist der Fall implementiert, der für meine Anwendung angepasst ist. In Deinem Fall kann es sein, dass Du mal eine oder die andere entity gar nicht brauchst.

VG

Last version, I’m using.
I had some problems with triggering of the template state and replaced the ‘t_current < t_goal’ part with the 't_below" state. Since it is the replicated information.

blueprint:
  name: Heizungssteuerung
  domain: automation
  input:
    climate_target:
      name: Thermostat
      description: Thermostat to be controlled
      selector:
        entity:
          domain: climate
#    t_current_target:
#      name: T_curr
#      description: Current temperature in room.
#      selector:
#        entity:
#          domain: sensor
    climate_trigger_t_above:
      name: Flag T > T_goal
      description: Flag, it the temperature T above T_goal
      selector:
        entity:
          domain: binary_sensor
    climate_trigger_t_below:
      name: Flag T < T_goal - T_delta
      description: Flag, it the temperature T below T_goal - T_delta
      selector:
        entity:
          domain: binary_sensor
    open_close_target:
      name: Door | Window - group
      description: Group of sensors for switching off the climate in "on"-state
      selector:
        entity:
          domain: group
    climate_auto_control_target:
      name: Manual switch for climate 
      description: Flag for activating / deactivating of climate control
      selector:
        entity:
          domain: input_boolean
mode: queued

variables:
  climate_target: !input climate_target
#  t_current_target: !input t_current_target
  open_close_target: !input open_close_target
  climate_auto_control_target: !input climate_auto_control_target
  climate_trigger_t_above: !input climate_trigger_t_above
  climate_trigger_t_below: !input climate_trigger_t_below

#  t_goal: "{{float(state_attr(climate_target, 'temperature'), 0)}}"
#  t_current: "{{float(states[t_current_target].state, 0)}}"

  debug_mode: 'off'
  
trigger:
  - platform: state
    entity_id: !input open_close_target
    for: 00:00:45
    from: 'off'
    to: 'on'
    id: trigger_open
  - platform: state
    entity_id: !input open_close_target
    from: 'on'
    to: 'off'
    for: 00:00:10
    id: trigger_close
  - platform: state
    entity_id: !input climate_auto_control_target
    from: 'on'
    to: 'off'
    id: trigger_steuerung_off
  - platform: state
    entity_id: !input climate_auto_control_target
    from: 'off'
    to: 'on'
    id: trigger_steuerung_on
  - platform: state
    entity_id: !input climate_trigger_t_above
    to: 'on'
    from: 'off'
    id: trigger_t_above
  - platform: state
    entity_id: !input climate_trigger_t_below
    to: 'on'
    from: 'off'
    id: trigger_t_below
  - platform: state
    entity_id: !input climate_target
    to: heat
    id: climate_to_heat
#  - platform: state
#    entity_id: !input climate_target
#    to: auto
#    id: climate_to_auto

condition: []

action:
  - choose:
###############################################################################
###############################################################################
    - conditions:
      - condition: trigger
        id: trigger_steuerung_off
      sequence:
      #  hold_temperature on to off -> check climate on
      - choose:
        - conditions: # check if on or auto
          - condition: not
            conditions:
            - condition: state
              entity_id: !input climate_target
              state: 'off'
          sequence:
          #  climate on -> turn off
          - service: climate.turn_off
            entity_id: !input climate_target
        default: [] #  climate off -> continue
###############################################################################
###############################################################################
    - conditions:
      - condition: trigger
        id: trigger_steuerung_on
      sequence:
      #  Called by hold_temperature
      #  hold_temperature off to on -> check if t < goal
      - choose:
        - conditions:
          - condition: state
            entity_id: !input climate_trigger_t_below
            state: 'on'
          sequence:
          #  t < goal is true -> check if heat on
          - choose:
            - conditions:
              - condition: state
                entity_id: !input climate_target
                state: 'off'
              sequence:
              #  climate off -> turn climate to heat mode
              - service: climate.turn_on
                entity_id: !input climate_target 
              - choose:
                - conditions:
                    - condition: not
                      conditions:
                      - condition: state
                        entity_id: !input climate_target
                        state: heat        
                  sequence:
                  #  climate off or auto -> turn climate to heat
                  - service: climate.set_hvac_mode
                    data:
                      hvac_mode: heat
                    entity_id: !input climate_target
                default: [] #  climate already on -> continue
            default: [] # climate already on -> continue
        default: [] # t < goal is false -> continue
###############################################################################
###############################################################################
    - conditions:
      - condition: trigger
        id: trigger_open
      sequence:
      # door/window open -> check hold_temperature
      - choose:
        - conditions:
          - condition: state
            entity_id: !input climate_auto_control_target
            state: 'on'
          sequence:
          #  hold_temperature on -> turn off hold_temperature
          - service: input_boolean.turn_off
            entity_id: !input climate_auto_control_target
        default:
        # hold_temperature off -> check climate on
        - choose:
          - conditions:
            - condition: not
              conditions:
              - condition: state
                entity_id: !input climate_target
                state: 'off'
            sequence:
            #  climate on -> turn off
            - service: climate.turn_off
              entity_id: !input climate_target
          default: [] #climate already off -> continue
###############################################################################
###############################################################################
    - conditions:
      - condition: trigger
        id: trigger_close
      sequence:
      # door/window closed -> check hold_temperature
      - choose:
        - conditions:
          - condition: state
            entity_id: !input climate_auto_control_target
            state: 'off'
          sequence:
          # hold_temperature off -> turn hold_temperature on
          - service: input_boolean.turn_on
            entity_id: !input climate_auto_control_target
        default: [] # hold_temperature on -> continue
###############################################################################
###############################################################################
#    - conditions:
#      - condition: trigger
#        id: climate_to_auto
#      #  '"climate auto -> 'heat' or 'off'"' 
#      sequence:
#      - choose:
#        - conditions:
#          - condition: template
#            value_template: '{{ t_current  < t_goal }}'
#          sequence:
#          #  climate off or auto -> turn climate to heat
#          - service: climate.turn_on
#            entity_id: !input climate_target 
#          - choose:
#            - conditions:
#                - condition: not
#                  conditions:
#                  - condition: state
#                    entity_id: !input climate_target
#                    state: heat        
#              sequence:
#              #  climate off or auto -> turn climate to heat
#              - service: climate.set_hvac_mode
#                data:
#                  hvac_mode: heat
#                entity_id: !input climate_target
#            default: [] #  climate already on -> continue
#        default: 
#            #  climate on -> turn off
#        - service: climate.turn_off
#          entity_id: !input climate_target
###############################################################################
###############################################################################
    - conditions:
      - condition: trigger
        id: climate_to_heat
      sequence:
      #  climate to heat -> check if hold_temperature is on
      - choose:
        - conditions:
          - condition: state
            entity_id: !input climate_auto_control_target
            state: 'off'
          sequence:
          # 'by climate on to heat: hold_temperature off -> turn on'
          - service: input_boolean.turn_on
            entity_id: !input climate_auto_control_target
        default: [] #  'by climate on to heat: hold_temperature on -> continue'
###############################################################################
###############################################################################
    - conditions:
      - condition: trigger
        id: trigger_t_above
      sequence:
    #  '"T > goal is true -> turn off climate"'
      - choose:
        - conditions: # check if on or auto
          - condition: not
            conditions:
            - condition: state
              entity_id: !input climate_target
              state: 'off'
          sequence:
          - service: climate.turn_off
            entity_id: !input climate_target 
        default: [] #  continue
###############################################################################
###############################################################################
    - conditions:
      - condition: trigger
        id: trigger_t_below
      sequence:
      #  T < goal - d for sensor or T < goal for climate is true -> check if heat on
      - choose:
        - conditions:
            - condition: and
              conditions:
              - condition: state
                entity_id: !input climate_auto_control_target
                state: 'on'
              - condition: not
                conditions:
                - condition: state
                  entity_id: !input climate_target
                  state: heat 
          sequence:
          #  climate off or auto -> turn climate to heat
          - service: climate.turn_on
            entity_id: !input climate_target 
          - choose:
            - conditions:
                - condition: not
                  conditions:
                  - condition: state
                    entity_id: !input climate_target
                    state: heat        
              sequence:
              #  climate off or auto -> turn climate to heat
              - service: climate.set_hvac_mode
                data:
                  hvac_mode: heat
                entity_id: !input climate_target
            default: [] #  climate already on -> continue
        default: [] #  climate already on -> continue
###############################################################################
###############################################################################
    default: []  #  Unknown trigger case
    #  '#### End of automation ####'

Mensch jetzt hab ich grad mal die vorletzte probiert :wink:
Jetzt muss ich nochmal fragen, wozu dient denn das t_delta?

Ich hatte nur angenommen das es bei deiner zweiten Anpassung nicht mehr notwendig war, kann mich aber auch irren :wink:
Aber sag mal wie verhält es sich eigentlich bei einem HA Neustart? Muss die Temp da neu gesetzt werden?

Und please share deine Lovelace Thermostat Config! :wink:

t_delta gibt an, wie weit die Temperatur von der Zieltemperatur fallen darf, bevor die Heizung wieder anspringt.
Sprich, du hast 20° eingestellt, bei t_delta 0.5 wird die Heizung (Thermostat) erst eingeschaltet, wenn die Temperatur unter 19.5 gefallen ist.
Man kann z.b. auch 1° wählen, dann ist aber doch spürbar kälter. Kleiner als 0.5 sehe ich nicht ganz sinnvoll, da der Thermostat ständig an und ausgehen wird.

Hmm, alles entscheidende für die Heizung aus der Config habe ich gepostet. Die Temperatur setzte ich mit dem anderen Blueprint (irgendwo oben im Verlauf gepostet).

Mehr gibt es nicht (zwar nutze ich noch ein Blueprint, um die interne Temperatur im Thermostat zu überschreiben, dieses ist aber nur ein Schönheitsfehler und keine Fehlfunktion).

Falls Du unbedingt die Config haben möchtest, schreibe mal ein PN mit deiner mail. Ich schmeiße alle privaten Sachen raus und kann dir diese meinetwegen schicken. Ob es einem hilft, ist eine andere Frage :wink:

Ach ja, zum Neustart: ähm, verstehe die Frage nicht. Die Zieltemperatur wird doch im Thermostat gesetzt / gespeichert. Neustart beeinflusst doch diese Temperatur nicht. Du kannst auch direkt am Thermostat die Temperatur ändern und dann soll Blueprint von mir mal auch triggern.

Na hierfür meine ich, wie hast du das so clean hinbekommen? Und wie die weiteren Entitäten hinzufügt?

Mmh dann ist Delta wohl doch ganz sinnvoll.
Übrigens aktuell läuft alles prima :wink:


Sollte nicht normalerweise das Thermostat aus gehen wenn die Zieltemperatur erreicht ist? Siehe Schlafzimmer und Badezimmer. Es ist weiterhin auf Modus heizen.

Check.
I use simple - thermostat. Here the example (some changes are there, since the first published version)

      - type: custom:simple-thermostat
        entity: climate.schlafzimmer_thermostat
        step_size: 0.5
        name: Schlafzimmer
        hide:
          temperature: true
          state: true
        sensors:
          - entity: input_boolean.schlafzimmer_autoheat
            name: Heizsteuerung
          - entity: input_boolean.schlafzimmer_anwesenheit
            name: Anwesenheit
          - entity: sensor.schlafzimmer_t
            name: Temperatur
          - entity: climate.schlafzimmer_thermostat
            name: Status
        control: false

Eigentlich ja, sollte ausgehen.
Überprüfe ob die Temperatur im Thermostat und die aktuelle korrekt im “t_below” und “t_above” richtig definiert sind.

In your case the “aktuell”-Temperatre is the internal temperature of the thermostat


(I’m unsing external sensor).
If you still want to use the internal sensor of your thermostat (I would not do it, due to inaccuracy), you have to use in “t_below/t_above” the “current_temperature”-attribute.

i.e.

{{ float(  state_attr('climate.wohnzimmer_thermostat', 'current_temperature') , 0) > float( state_attr('climate.wohnzimmer_thermostat', 'temperature') , 0) }}

I asume your themostat uses the same attribute-names.

I you use also external temperature sensor, so your picture shows “wrong” temperature, since it is the internal of your thermostat. Therfore it is still possible, that internal is higher than goal, due to lower external temperature, as your goal :slight_smile: :slight_smile:

I hope you are following on this.

cheers

just for your information.
There is a way to overwrite the internal temperature attribute-value, by the value of an external sensor (I’m doing this).
The blueprint is

blueprint:
  name: Update temperature of the thermostat
  domain: automation
  input:
    climate_target:
      name: Thermostat
      description: Thermostat to be updated
      selector:
        entity:
          domain: climate
    t_current_target:
      name: T_curr
      description: Current temperature in room.
      selector:
        entity:
          domain: sensor
mode: queued

variables:
  climate_target: !input climate_target
  t_current_target: !input t_current_target

  t_thermostat: "{{float(state_attr(climate_target,'current_temperature') , 0)}}"
  t_current: "{{float(states[t_current_target].state, 0) }}"


trigger:
  - platform: state
    entity_id: !input climate_target
    id: climate
  - platform: state
    entity_id: !input t_current_target
    id: temperature

condition: []

action:
  - choose:
    - conditions:
      - condition: template
        value_template: '{{ (t_current != t_thermostat) and (t_current  != 0) and (t_thermostat != 0) }}'
      sequence:
      - service: python_script.thermostat_update
        data_template:
          temp_only: true
          thermostat: !input climate_target
          sensor: !input t_current_target
    default: []

The python-script is not mine, I’ll post the link to it:
here github-link

hey there, your automation looks pretty amazing but im not totally sure, which extra components i have to setup in Home Assistant to get it working - in my little glimpse ive taken i see i need some binaries (above_goal_t, below_goal_t) some input_numbers (t_delta, system_delta_goal_t) and some input_booleans.

do you have an list or overview which of these i exactly need if i wanted to add a room with your automation?

im asking, because im trying to get this setup with 4 rooms and im totally lost here=( sorry if im not getting something obvious here.

Grüße und einen schönen Tag

Flipso