Temperature as trigger for automation

2022.5 I used this template as trigger and it no longer works with 2022.6

{{ state_attr("climate.downstairs", "current_temperature") > 74 }}

It works in dev tools just fine, but doesn’t work as trigger.

Also tried this as trigger

platform: numeric_state
entity_id: climate.downstairs
attribute: current_temperature
above: '74'

Neither seem to work

The temperature has to go from below 74 to above 74 to trigger. If it is already above 74 when you save/reload the automation, or if it changes state above 74 (e.g. 77 to 78), it won’t trigger.

1 Like

Yes it used to work like that now it doesn’t with latest upgrade.

Also have one for temp outside vs inside and notify that it’s time to open windows that doesn’t fire since 2022.6

Played with it some more today and the numeric state works, but the template doesn’t work any more. Now to rework automations…

Check that your climate entity attribute still exists and that it is reporting a number, because it works for me:

Works fine in dev tools but doesn’t trigger automations like they used to

1 Like

That’s not possible. Show your full automation.

Here is the adjusted one that’s working

alias: Family Room Fan Turn on when warm enough and TV is on
description: ''
trigger:
  - platform: numeric_state
    entity_id: climate.downstairs
    attribute: current_temperature
    above: '74'
condition:
  - condition: state
    entity_id: remote.family_room_tv
    state: 'on'
action:
  - device_id: 07f58f2941334d04abb89e17adcd3041
    domain: fan
    entity_id: fan.family_room
    type: turn_on
  - service: fan.set_percentage
    data:
      percentage: 100
    target:
      device_id: 07f58f2941334d04abb89e17adcd3041

Here is the one that used to work for telling me when to open the windows

alias: Notify - Time to open the windows broadcast
description: ''
trigger:
  - platform: state
    entity_id: sensor.openweathermap_temperature
condition:
  - condition: template
    value_template: >-
      {{ state_attr('weather.openweathermap', 'temperature') <=
      state_attr('climate.upstairs', 'current_temperature') }}
  - after: '15:00:00'
    before: '21:00:00'
    condition: time
  - condition: and
    conditions:
      - type: is_not_open
        condition: device
        device_id: b3e1c3d3100711eb9a73b1e7b740c7d0
        entity_id: binary_sensor.master_bedroom_window_sensor_left
        domain: binary_sensor
      - condition: or
        conditions:
          - type: is_not_open
            condition: device
            device_id: 4495b2117b1b084724f7b404939d51f9
            entity_id: binary_sensor.master_bedroom_window_sensor_right
            domain: binary_sensor
  - condition: numeric_state
    entity_id: sensor.aqi
    attribute: level
    below: '2'
  - condition: template
    value_template: '{{ state_attr(''climate.upstairs'', ''current_temperature'') > 70 }}'
  - condition: template
    value_template: '{{ state_attr(''weather.openweathermap'', ''temperature'') > 66 }}'
action:
  - service: tts.google_translate_say
    data:
      entity_id: media_player.all_indoor_speakers
      message: >-
        It's time to open the windows. It's {{
        state_attr('weather.openweathermap',     'temperature') | round(0) }}
        degrees outside and {{     state_attr('climate.upstairs',
        'current_temperature') }} inside.
  - device_id: b82023aa92fd91c90941a126bc210e36
    domain: cover
    entity_id: cover.master_bedroom_large_windows_left_curtain
    type: set_position
    position: 100
  - device_id: b136983557e931d8e3174e1554a4fc0a
    domain: cover
    entity_id: cover.master_bedroom_large_windows_right_curtain
    type: set_position
    position: 100
mode: single

Well that’s completely different from the template you posted originally. It helps if you post the actual template you are using. Don’t simplify it. That just means people helping you aren’t working with the actual issue.

Are both of these attributes numbers with the same format?

    value_template: >-
      {{ state_attr('weather.openweathermap', 'temperature') <=
      state_attr('climate.upstairs', 'current_temperature') }}

If not you may have to convert them to numbers before testing with the comparison:

    value_template: >-
      {{ state_attr('weather.openweathermap', 'temperature')|float(0) <=
      state_attr('climate.upstairs', 'current_temperature')|float(0) }}

Also did you check your log for template errors?

1 Like