I need your help, we’re going through a deep freeze low temperature in the north west and my boiler home heating pipe got frozen and burst. For next time I took some precautionary measures to help prevent frozen pipes. Another idea came to mind is use Home Assistant alerts to warn me if my Basement Boiler Room temperature sensor is below 60 degrees Fahrenheit and repeat every 30 minutes until temperature rises above 60 degrees Fahrenheit. This every 30 minutes warning notification will help me make sure I take action until problem is solved.
My sensor details:
Bsmt Boiler Room
My weather station Temp 4
entity: sensor.my_weather_station_temp_4
state_class: measurement
unit_of_measurement: °F
device_class: temperature
friendly_name: My weather station Temp 4
This example will begin firing as soon as the entity sensor.motion’s battery attribute falls below 15. It will continue to fire until the battery attribute raises above 15 or the alert is acknowledged on the frontend.
So I need to make a similar alert that will fire when Basement boiler room temperature drops below 60 degrees Fahrenheit and continue to fire every 30 minutes until temperature rises above 60.
I started with this:
template:
My weather station Temp 2:
name: Basement Boiler Room Temperature is too cold
done_message: Basement Boiler Room temperature is now normal
entity_id: sensor.my_weather_station_temp_2
state: "{{ state_attr('sensor.my_weather_station_temp_2', 'measurement') | float(default=0) < 60 }}"
repeat: 30
can_acknowledge: true
skip_first: true
notifiers:
- basement_and_1stfloor
Are you sure that state_attr('sensor.my_weather_station_temp_4', 'measurement') is correct? Most temperature sensors will have the temperature as the state, not as an attribute called measurement.
template and alert are two seperate top-level headings… you can’t mash them together into one thing. If you already have template or alert headings in your configuration you will need to add the new entities under the existing headings.
template:
- binary_sensor:
- name: Boiler Room Temp Low
state: >
{{ state_attr('sensor.my_weather_station_temp_4', 'measurement') | float(0) < 60 }}"
availability: >
{{ state_attr('sensor.my_weather_station_temp_4', 'measurement') | float('no') is number }}"
alert:
my_weather_station_temp_2:
entity_id: binary_sensor.boiler_room_temp_low
name: Basement Boiler Room Temperature is too cold
done_message: Basement Boiler Room temperature is now normal
repeat: 30
can_acknowledge: true
skip_first: true
notifiers:
- basement_and_1stfloor
It’s great to be notified but this is the kind of thing HA is made for. How about a small heater with a switch/plug when the temp is below desired temperature. An automation would turn on/off the heater as needed.
Thanks Didgeridrew, for quick response. Not sure if state_attr supposed to be measurement, wish there was a way to check through developer tools section or something. I took your advice and replaced ‘measurement’ with ‘state’. I’ll see what happens, as a test I turned off heat and see if I get an audio tts alert on my basement and 1st floor speakers.
Revised alert in /config/configuration.yaml looks like this:
Yes I tried it in developer tools “states tool” section and it was helpful.
Modified it again (final code shown below) and test was successful!
Thanks again for your help.
#Templates
template:
- binary_sensor:
- name: Boiler Room Temp Low
state: "{{states('sensor.my_weather_station_temp_4') | float(0) < 60 }}"
availability: "{{states('sensor.my_weather_station_temp_4') | float('no') is number }}"
# Alerts
alert:
light_dimmer:
name: Second floor fitness/office room light is on
done_message: Second floor fitness/office room light is now off
entity_id: light.fitness_office_room_2_dimmer_3
state: "on"
repeat: 5
can_acknowledge: true
skip_first: true
notifiers:
- basement_and_1stfloor
my_weather_station_temp_4:
entity_id: binary_sensor.boiler_room_temp_low
name: Warning Basement Boiler Room temperature is below sixty degrees Fahrenheit home water pipes may freeze
done_message: Basement Boiler Room temperature is now normal
repeat: 30
can_acknowledge: true
skip_first: true
notifiers:
- basement_and_1stfloor
- 2nd_floor