Just getting started with Home Assistant and I have things working but not 100% how I would like them to work.
I have 12 Temperature\Humidity Sensors using ESP32 and DHT22 setup with ESPHome.
My goal is to have alerts if the temp goes too high and would like that to repeat every day until corrected. Another alert once temp drops below the high temp with just a single notification.
An online/offline alert that is similar to above that an alert when it goes offline that repeats daily until fixed and a single alert that it’s back online.
All triggers would require a change that stayed the same for 10 minutes to eliminate false notifications. Specifically for the online/offline alerts as some of these sensors are connected over VPN.
So far I have 4 automations trying to achieve this. It’s kinda working but I get random alerts that a sensor is back online without getting one that said it went offline. As well as random alerts that the temp is back to normal but I didn’t get one that said it was high.
I do however get one if I unplug for 10 minutes or heat the sensor up, and get one that it has reconnected or returned to normal. So not sure why the random ones happen.
Attaching config for the 4 alerts.
Thanks
alias: Temperature is back to normal
description: ''
triggers:
- entity_id:
- sensor.home_test_1_temperature
- sensor.home_test_2_temperature
for:
hours: 0
minutes: 10
seconds: 0
below: 74.9
trigger: numeric_state
conditions: []
actions:
- data:
title: Temperature has returned to normal at {{ area_name(trigger.entity_id) }}
message: |
{{ trigger.to_state.name }} is currently {{trigger.to_state.state }}F.
action: notify.persistent_notification
- device_id: 616ce30e32bb2a988ad7d543b1c0eafd
domain: mobile_app
type: notify
message: '{{ trigger.to_state.name }} is currently {{trigger.to_state.state }}F.'
title: Temperature has returned to normal at {{ area_name(trigger.entity_id) }}
mode: single
alias: High Temperature Alert
description: ""
triggers:
- entity_id:
- sensor.home_test_1_temperature
- sensor.home_test_2_temperature
for:
hours: 0
minutes: 10
seconds: 0
above: 75
trigger: numeric_state
conditions: []
actions:
- data:
title: High Temperature Alert at {{ area_name(trigger.entity_id) }}
message: |
{{ trigger.to_state.name }} is currently {{trigger.to_state.state }}F.
action: notify.persistent_notification
- device_id: 616ce30e32bb2a988ad7d543b1c0eafd
domain: mobile_app
type: notify
message: "{{ trigger.to_state.name }} is currently {{trigger.to_state.state }}F."
title: High Temperature Alert at {{ area_name(trigger.entity_id) }}
mode: single
alias: Device Offline Alert
description: ""
triggers:
- alias: When entities go offline
entity_id:
- sensor.home_test_1_temperature
- sensor.home_test_2_temperature
to: unavailable
id: Devices Offline
for:
hours: 0
minutes: 10
seconds: 0
trigger: state
conditions: []
actions:
- data:
title: Device Offline at {{ area_name(trigger.entity_id) }}
message: |
{{ trigger.to_state.name }} is currently Offline.
action: notify.persistent_notification
- device_id: 616ce30e32bb2a988ad7d543b1c0eafd
domain: mobile_app
type: notify
message: "{{ trigger.to_state.name }} is currently Offline."
title: Device Offline at {{ area_name(trigger.entity_id) }}
mode: single
alias: Device Online Alert
description: ""
triggers:
- alias: When entities go online
entity_id:
- sensor.home_test_1_temperature
- sensor.home_test_2_temperature
from: unavailable
id: Devices Offline
for:
hours: 0
minutes: 10
seconds: 0
trigger: state
conditions: []
actions:
- data:
title: Device Online at {{ area_name(trigger.entity_id) }}
message: |
{{ trigger.to_state.name }} is currently Online.
action: notify.persistent_notification
- device_id: 616ce30e32bb2a988ad7d543b1c0eafd
domain: mobile_app
type: notify
message: " {{ trigger.to_state.name }} is currently Online."
title: Device Online at {{ area_name(trigger.entity_id) }}
mode: single