I wanted to create an automation that would allow me to receive a notification on my phone when the temperature of the CPU of my raspberry had exceeded a certain temperature (for example 45°C).
I wrote this template and used it as an automation trigger. However it doesn’t trigger!!!
The automation is the following one:
- id: '1623724337543'
alias: Automazione Alert CPU
description: ''
trigger:
- platform: template
value_template: "{% if states('sensor.cputemp') != '40' %}\n True\n{% else %}\n\
\ false\n{% endif %}"
condition: []
action:
- service: notify.mobile_app_pixel_4_xl
data:
title: Home Assistant
message: '!!!ALERT!!! La temperatura della CPU ha raggiunto e/o superato i 55°C'
mode: single
- id: '1623724337543'
alias: Automazione Alert CPU
description: ''
trigger:
- platform: numeric_state
entity_id: sensor.cputemp
above: 45
condition: []
action:
- service: notify.mobile_app_pixel_4_xl
data:
title: Home Assistant
message: '!!!ALERT!!! La temperatura della CPU ha raggiunto e/o superato i 45°C'
mode: single
No! I tried that! It won’t trigger either!
I searched on the web and I found that is possible that some sensors give “not numeric” values… So the solution was to create a template from these sensors to fire the automation…
But what if I do a server restart? Doesn’t it work either? Does it necessarily have to exceed the temperature value to perform the automation?
I thought that after a server restar, If it had found a value greater than 45, it would have started the automation