Hello! I would appreciate any assistance for creating an automation that could alert me when the temperature continues to rise over the course of 3-4 hours for a temperature sensor (let’s say “Second Floor Average”
For example, I’d like to alert me when Home Assistant notices this climb as pictured in this history graph.
I’ve tried the trend sensors, but they are quite complicated to configure and they are binary, so it’s difficult to understand if I can use them to say “when this sensor is upward trending for X hours” etc.
Thank you!
binary_sensor:
- platform: trend
sensors:
second_floor_temperature_rising:
entity_id: sensor.second_floor_average
sample_duration: 7200
max_samples: 120
min_gradient: 0.0004
trigger:
- platform: state
to: 'on'
entity_id: binary_sensor.second_floor_temperature_rising
for: "02:30:00"
....
It’s hard to tell from what you’ve provided, but if your temperature readings are choppy, it can help a lot to add some filtering. In the following you can see that the trend of the filtered version of the sensor captures rising earlier and holds it even when the raw temperature’s trend does not.
Filtered Sensor Details
sensor:
- platform: filter
name: "upstairs filtered temperature"
entity_id: sensor.average_upstairs_temperature
filters:
- filter: outlier
window_size: 4
radius: 2.0
- filter: lowpass
time_constant: 10
- filter: time_simple_moving_average
window_size: "00:10"
precision: 2
binary_sensor:
- platform: trend
sensors:
upstairs_filtered_temp_rising:
entity_id: sensor.upstairs_filtered_temperature
sample_duration: 7200
max_samples: 120
min_gradient: 0.0004
1 Like
Thank you! I setup both the filtered sensors and the trends as you helped with. I appreciate it!