Heating Automation issue

Hi. I’m running into some logic problems with an automation I have. It might be logic in my head that’s not working, but maybe it’s actually how I configured it in HA.

How it should work:
If one of the study TRVs detect that the current temperature is lower than the target temperature, then it should set the temperature of the living room to 19. But this should only happen if the living room is not currently asking for heat (Ie if the current temperature is equal to or higher than the target temperature).

Problem is that it seems if the target and current temperature of the living room are close it’s not enough to trigger the setting. Any thoughts?

alias: Study Ask Heat
description: ""
trigger:
  - platform: numeric_state
    entity_id: climate.lumi_lumi_airrtc_agl001_thermostat
    value_template: "{{ state.attributes.current_temperature - state.attributes.temperature }}"
    below: 0
  - platform: numeric_state
    entity_id: climate.lumi_lumi_airrtc_agl001_thermostat_2
    value_template: "{{ state.attributes.current_temperature - state.attributes.temperature }}"
    below: 0
condition:
  - condition: numeric_state
    entity_id: climate.incomfort_1
    value_template: "{{ state.attributes.temperature - state.attributes.current_temperature }}"
    above: 0
    enabled: true
  - condition: not
    conditions:
      - condition: numeric_state
        entity_id: climate.incomfort_1
        value_template: >-
          {{ state.attributes.current_temperature - state.attributes.temperature
          }}
        below: 0
    enabled: true
action:
  - device_id: 90ed87e3fcc7dbd52e4ad12748189c45
    domain: mobile_app
    type: notify
    message: Living Room 19
  - service: climate.set_temperature
    data:
      temperature: 19
    target:
      entity_id: climate.incomfort_1
mode: single

The way you have it set up, the numeric state trigger is only reevaluated when the state of the entity updates. The state of climate entities is not numeric, so this too may cause issues in a Numeric state trigger. You can add an attribute variable to fix that, but it will still be unresponsive to a change of the temperature set point.

When combined, your condition section can never be true.

While the value template function of Numeric state triggers and conditions is great for minor adjustments, they become less appropriate with more complicated templates. The better solution is to just use templates.

alias: Study Ask Heat
description: ""
trigger:
  - platform: template
    value_template: >
      {% set therm = states['climate.lumi_lumi_airrtc_agl001_thermostat'] %}
      {{ therm.attributes.current_temperature < therm.attributes.temperature }}
  - platform: template
    value_template: >
      {% set therm = states['climate.lumi_lumi_airrtc_agl001_thermostat_2'] %}
      {{ therm.attributes.current_temperature < therm.attributes.temperature }}
condition:
  - condition: template
    value_template: >
      {% set therm = states['climate.climate.incomfort_1'] %}
      {{ therm.attributes.temperature > therm.attributes.current_temperature }} 
action:
  - device_id: 90ed87e3fcc7dbd52e4ad12748189c45
    domain: mobile_app
    type: notify
    message: Living Room 19
  - service: climate.set_temperature
    data:
      temperature: 19
    target:
      entity_id: climate.incomfort_1
mode: single
1 Like

Oh great, that works, thanks! (After 2 small errors I could easily fix.)

Would this also trigger if say the Living Room reaches the right temperature but the TRVs still need heat? Theoretically I guess it would as soon as either the current temp or the target temp of the TRV changes even a little right?