I am trying to work out how to make a notification of overnight temp.
The simple description is at the end I would like a notification on app at a time in the morning that is:
“overnight* the temp was xc,at HH:mm, it is currently yc”
I have a max min sensor from the original temperature - but what next ? I can find lots of ways to get info “now” but nothing to look back at what it was, and pick that one bit of data.
This is not exactly what I think you are trying to accomplish, but I use the automations shown below to monitor if the temperatures in a fridge/freezer I have stays above a given temperature of a given period of time. If so I get a notification. I think you might be able to create an ‘average’ sensor for last say 12 hours and incorporate that into your solution, I am using this custom sensor with good results:
:
- alias: 'High freezer temperature'
trigger:
- platform: numeric_state
entity_id: sensor.freezer_govee_temperature
above: 25
for:
minutes: 30
action:
service: notify.pushover
data:
message: 'Freezer temperature has been above 25ºF for 30 minutes'
data:
priority: 1
sound: gamelan
- alias: 'High refrigerator temperature'
trigger:
- platform: numeric_state
entity_id: sensor.refrigerator_govee_temperature
above: 50
for:
minutes: 30
action:
service: notify.pushover
data:
message: 'Refrigerator temperature has been above 50ºF for 30 minutes'
data:
priority: 1
sound: gamelan
I think I may have a play with, I was looking to avoid averages right now as looking at the last few days its been still quite warm over night until the last few hours where its really dropped. Hence wanting to know specific time also, if it was -1 over night but +2 now its at least going to be easier to get the ice off the car.
- platform: template
sensors:
lowest_temp:
friendly_name: "Lowest temp at time"
value_template: >
{% set time = states('sensor.time') %}
{% if states('sensor.time') == "00:01" %}
1000.0@00:00
{% else %}
{% if states('sensor.dark_sky_temperature') | float < states('sensor.lowest_temp').split('@')[0] | float %}
{{ states('sensor.dark_sky_temperature') | float }}@{{ time }}
{% else %}
{{states('sensor.lowest_temp') }}
{% endif %}
{% endif %}
you’ll have to set up the sensor.time first.
then put in your own temperature entity you are trying to track.
It should only update the sensor if the temp is lower than the last temp reading in the sensor.
And it will reset the temp every day at one minute after midnight to a ridiculously high number so it’s obvious that it hasn’t tracked anything yet. You can set that to any time you want along with whatever default starting temp you want. But as soon as the temp is less than 1000 degrees it will update the temp and time.
the only downside I see is I’m not sure that the sensor will maintain it’s state thru restarts. But I think it should.
I got a solution elsewhere that “seems” to be working - I am sure there is a cleaner way. I think i was stuck on the idea of being able to pick a time span over a recent past time
- platform: min_max
type: min
name: maxmin lowest temp
entity_ids: sensor.temperature_2
- platform: statistics
name: maxmin lowest temp time of maxmin ofter 600min
entity_id: sensor.maxmin_lowest_temp
max_age:
minutes: 600
then for my notify
message: >-
Overnight the temperature was {{
state_attr('sensor.maxmin_lowest_temp_time_of_maxmin_ofter_600min',
'min_value') }}c it is currently {{ states('sensor.temperature_2') }}c