Automation - value above attribute value

Hi there.
New to home assisstant. Trying to create simple automation: Notification to my cell phone once Sauna temperature reaches the set temperature. When I put simple number (80) in “above:” then it works. If I try to put attribute value, it does not work. Can you help me out?

alias: Sauna
description: ""
trigger:
  - platform: numeric_state
    entity_id:
      - climate.sauna_saunabox_thermostat
    attribute: current_temperature
    above: "{{ state_attr('climate.sauna_saunabox_thermostat', 'temperature') | float }}"
condition: []
action:

It doesn’t work because the above option doesn’t support templates.

However, it does support specifying the entity_id of an entity whose state value is numeric (like sensor, number, and input_number). I suggest you create a Template Sensor that simply reports the value of your climate entity’s temperature attribute.

  - sensor:
      - name: Sauna Temperature
        unique_id abc123xyz
        state: "{{ state_attr('climate.sauna_saunabox_thermostat', 'temperature') }}"
        unit_of_measurement: "°C"
        device_class: temperature

You can then reference it in your Numeric State Trigger like this:

trigger:
  - platform: numeric_state
    entity_id:
      - climate.sauna_saunabox_thermostat
    attribute: current_temperature
    above: sensor.sauna_temperature
1 Like

above: doesn’t support templates.
Just use a template trigger.

Thanks a lot. It’s working now.
One additional question - I cannot find the right syntax when trying to put
‘’
above: sensor.xxx - 5

That’s not supported.

I suggest you simply perform the subtraction in the Template Sensor.

  - sensor:
      - name: Sauna Temperature
        unique_id: abc123xyz
        state: "{{ state_attr('climate.sauna_saunabox_thermostat', 'temperature') | float(0) - 5 }}"
        unit_of_measurement: "°C"
        device_class: temperature

Then use the same Numeric State Trigger I had suggested previously.

trigger:
  - platform: numeric_state
    entity_id:
      - climate.sauna_saunabox_thermostat
    attribute: current_temperature
    above: sensor.sauna_temperature
1 Like

Works perfectly! Thank you!

1 Like