I have an automation which notifys me when the temp drops to below 32 degrees F. It repeats this at every 5 degree fall in temperature. The problem is that the temperature sometimes hovers around one of the thresholds and triggers numerous notifications in a short period of time. I could use a time condition of “FOR” but this would not notify me immediately when the temp hit the threshold. How can I de-bounce this? Last night it notified ma about every 30 minutes that the temperature was 24.8 degrees, which is the first value under the 25 degree threshold.
id: ‘1608904459108’
alias: Notify me when it drops below 32
description: Notify me when the temperature drops below 32
trigger:
service: notify.mobile_app_sm_g950u
data:
title: Home Assistant Weather report !
message: 'Outside temperature is {{ states (“sensor.temp”)}} degrees!
'
service: notify.alexa_media_echo_dot
data:
title: Home Assistant Weather Alert !
message: 'It is getting colder outside! The temperature is {{ states (“sensor.temp”)}}
Degrees!
First off you in the future you need to make sure you format your code correctly in the post so we can see syntax. put three backticks ``` on the line before and after the code.
but as to you question…
you can make a condition that looks at the last triggered time of the automation and only trigger again if it’s been longer than a certain time in seconds:
You might have a look at this:
Average Sensor for Home Assistant
‘This sensor allows you to calculate the average state for one or more sensors over a specified period. Or just the average current state for one or more sensors, if you do not need historical data.’
Also, I use the following syntax in some of my temperature notifications:
- alias: 'High freezer temperature'
trigger:
- platform: numeric_state
entity_id: sensor.freezer_govee_temperature
above: 25
for:
minutes: 40
action:
service: notify.pushover
data:
message: 'Freezer temperature has been above 25ºF for 40 minutes'
data:
priority: 1
sound: gamelan