I have an automation to tell me when DHT22 devices become unavailable. This happens because of dirty earth, something that’s hard to fix at the moment, but by taking the power off a few seconds, at least they come back online. So I wrote this check to warn me when it happens. The problem is that the automation itself gets disabled, apparently by one of the trigger terms being unavailable.
Can someone explain why this happens and how to fix it?
alias: Notify when DHT22 unavailable
trigger:
- platform: state
entity_id:
- sensor.badkamer_temperatuur
- sensor.bruno_temperatuur
- sensor.flexkamer_temperatuur
- sensor.slaapkamer_temperatuur
- sensor.valentijn_temperatuur
- sensor.living_room_temperature
to: unavailable
for:
hours: 0
minutes: 5
seconds: 0
action:
- service: notify.NOTIFY_ADMIN
data:
message: |
{{ trigger.to_state.name }} has gone unavailable
- service: climate.turn_off
data_template:
entity_id: |
{{'climate.' + trigger.to_state.name.split(' ')[0] + '_thermostaat'}}
initial_state: "off"