Could someone please help by showing me the best way to do a low temperature notification? I used the GUI to create the following automation, but it doesn’t look very reliable. I would like the automation to check the temperature at regular intervals instead of just alert me if it detects a change below my threshold. I have this, and I think it is working, but if I set the temperature below the current temperature for testing, nothing happens, which makes me think that it is only looking for the change from above 40 to below 40, but if it somehow missed the change, nothing happens.
Thanks!
alias: Well House Temperature Notification
description: ""
trigger:
- type: temperature
platform: device
device_id: d3b5d56d017892c5a0008d98cfb7d771
entity_id: 20f673698566bf4cf530d691eef735df
domain: sensor
below: 40
for:
hours: 0
minutes: 2
seconds: 0
condition: []
action:
- service: notify.mobile_app_iphone
metadata: {}
data:
message: Well House Temperature is Critical!
- service: notify.persistent_notification
metadata: {}
data:
message: Well House Temperature is Critical!
mode: single
Correct; that’s how the trigger you chose works. It detects when the sensor’s value crosses below the threshold of 40, then stays below 40 for at least 2 minutes.
That’s ideal for reporting when the temperature drops below a threshold.
Or do you want to be repeatedly notified by every temperature decrease below 40? In other words, if the temperature is currently 38 and decreases to another value lower than 40, like 36, you want to be notified again.
I would like to check the temperature every 5 minutes and alert me instead of just looking for the crossover. that would be a lot more reliable, and survive restarts and outages, right?
I have a sketchy signal out there, so my next step is to get a notification if the sensor is unavailable for a longer period of time too.
it would be better than not knowing, but it would probably be better if it didn’t spam me too hard, but now that sounds like it’s asking for too much. maybe I could limit the notifications to no more than one per hour?
if it were checking the current temperature on some timer interval, then it wouldn’t be looking for a one time crossover event that it could easily miss.
If you want to check for temperature continuously, add a time trigger and in a condition probe the value to decide whether to continue to the notification actions.
The crossover would have to occur at the exact moment you restarted Home Assistant in order for it to be missed. If you are in the habit of restarting Home Assistant frequently then you will need to avoid using it … plus many other features as well.
Can you provide more details about your intended application? Being warned every hour about a cold well house seems worthless if there’s no ability to mitigate the cause of the low temperature in order to stop the notifications. However perhaps there are unmentioned details of your application that would justify a constantly nagging reminder.
Only a State Condition supports the for option and it wouldn’t work for applesauce’s application. Therefore applesauce would have to forego the “for at least two minutes” part of “the temperature must be below 40 for at least two minutes”.
thanks! now I understand, the timer is the trigger and the temperature is the condition. this is working perfectly now, except for any anti-spam feature I may need. I like the idea of checking every minute like this, but it would be nice to limit notifications to one per hour. could you expand on that part of your instructions, if you know of a way to do that part?
alias: Well House Temperature Notification
description: ""
trigger:
- platform: time_pattern
seconds: "1"
condition:
- type: is_temperature
condition: device
device_id: d3b5d56d017892c5a0008d98cfb7d771
entity_id: 20f673698566bf4cf530d691eef735df
domain: sensor
below: 40
action:
- service: notify.mobile_app_iphone
metadata: {}
data:
message: Well House Temperature is Critical!
- service: notify.persistent_notification
metadata: {}
data:
message: Well House Temperature is Critical!
mode: single
true. I was thinking that if it happened overnight while sleeping, but that makes me realize that I need to set my iPhone to allow notifications from home assistant while do not disturb is on overnight too. I appreciate all of your input and questions. my well froze solid a couple of nights ago here in central Missouri and by some miracle, I didn’t burst any pipes, but I am not looking to try that experiment again.
For notification rate limiting simply add a time wait action after the notification. The automation won’t run (if it’s on single mode, which is the default) while the wait action is running.
actually it only triggers the first second of every minute of every hour. the timer is a bit weird, but it is now checking once every minute and will not run again for one hour. perfect! And allowing notifications on iPhone while dnd is active was easy enough. Should be Safe now
Seems like you silently discarded the “for two minutes” requirement but that’s moot now.
The suggestion to use a 1 hour delay, as a means of throttling the notifications, is a kludge. I’m surprised you adopted it considering your concerns about reliabilty, surviving restarts and outages, etc (it won’t). Plus there are operational consequences that will eventually reveal themselves to you.
For anyone else having a similar application, I recommend creating a Template Binary Sensor to report on when the temperature drops below a threshold. Use it with the Alert integration to manage the frequency of notifications. It’s efficient and robust.