Automating an alarm using climate state attributes

Hi there,

I wonder if anyone can help me with an irritating issue i’m having with my automation.

I have a fridge that i use to keep beer kegs cold, it is controlled by an Inkbird, showing as a climate entity in HA.

Yesterday, I left the door ajar, and the fridge overheated and iced up. I would like to send a notification to my phone when the temp of the fridge is 3c greater than the setpoint.

So i can set up a keg alarm entity using this value template

{{state_attr("climate.01885101dc4f227adf84","current_temperature") > state_attr("climate.01885101dc4f227adf84","temperature") + 3 }}

An then could use that in the automation, but I fear that because i don’t use lots of value templates, they will get lost, when i have to debug the automation.

What i really wanted to do was this:

- id: "12"
  alias: "Keg Fridge warning"
  # the current temp is 3C grater than the set tempp
    platform: template
    value_template: "{{ state_attr("climate.01885101dc4f227adf84","current_temperature") > (state_attr("climate.01885101dc4f227adf84","temperature") + 3) }}"

    - service: notify.mobile_app_pixel_2
        message: 'Keg fridge over temp'

But i think this fails because the trigger is a limited template and can’t use state_attr.

Does anyone have any cunning plans, or should I just set up the keg_alarm entity using a value template?


Create a sensor using template platform and use that as trigger input?

The problem is the way you are using quotes. Use double quotes outside the template and single quotes inside, otherwise this is all Home Assistant sees:

value_template: "{{ state_attr("


value_template: "{{ state_attr('climate.01885101dc4f227adf84','current_temperature') > (state_attr('climate.01885101dc4f227adf84','temperature') + 3) }}"

Your attributes appear to be numbers so converting them from strings to floating point numbers like this should not be required:

value_template: "{{ state_attr('climate.01885101dc4f227adf84','current_temperature')|float > (state_attr('climate.01885101dc4f227adf84','temperature')|float + 3) }}"

I think that has sorted it, obvious i guess. Thank you so much

I think i got tripped up as this page suggests that states aren’t supported in limited templates.

I am misunderstanding the documentation?

The template trigger is not a limited template,

Ah. I can see that now.

This was the section that i think caught me out:

Yeah the first time I read that made me :eyes: too. Reading the trigger descriptions explicitly state if they use limited templates, e.g. the Event or MQTT triggers

1 Like