Hi,
I have some Aqara Water Leak sensors, connected via Zigbee->Zigbee2MQTT->Home Assistant.
They works fine and they detect dry and moisture. I created this Automation to send me notification, when status change:
alias: Water Leak Notification
description: Send a Notification when Water Leak Sensor Detect Moist
trigger:
- type: moist
platform: device
device_id: 83ec0ea70514efc5c8b3b9010ae5663e
entity_id: b3614c30067eb04c8ed22864cad70ae8
domain: binary_sensor
id: WC_,moist
- type: moist
platform: device
device_id: 1061b11f8cfda0cd845a81956479b37d
entity_id: 8389006168a00169997a0f8e81697bfa
domain: binary_sensor
id: LavaboCucina_moist
- type: moist
platform: device
device_id: 2b8bd04267ecf65e720fdaec13b15631
entity_id: 1fff943fe6c070e87bf5f3b4e595c2c6
domain: binary_sensor
id: LavaboBagno01_moist
- type: not_moist
platform: device
device_id: 83ec0ea70514efc5c8b3b9010ae5663e
entity_id: b3614c30067eb04c8ed22864cad70ae8
domain: binary_sensor
id: WC_dry
- type: not_moist
platform: device
device_id: 1061b11f8cfda0cd845a81956479b37d
entity_id: 8389006168a00169997a0f8e81697bfa
domain: binary_sensor
id: LavaboCucina_dry
- type: not_moist
platform: device
device_id: 2b8bd04267ecf65e720fdaec13b15631
entity_id: 1fff943fe6c070e87bf5f3b4e595c2c6
domain: binary_sensor
id: LavaboBagno01_dry
condition: []
action:
- if:
- condition: or
conditions:
- condition: trigger
id:
- WC_,moist
- LavaboCucina_moist
- LavaboBagno01_moist
then:
- service: notify.pushover
data:
message: >-
Water Leak Sensor {{ trigger.to_state.name }} detect a moist
condition
title: Water Leak Sensor Alarm
data:
priority: 2
retry: 60
expire: 5
sound: siren
- if:
- condition: or
conditions:
- condition: trigger
id:
- WC_dry
- LavaboCucina_dry
- LavaboBagno01_dry
then:
- service: notify.pushover
data:
message: Water Leak Sensor {{ trigger.to_state.name }} detect a dry condition
title: Water Leak Sensor Clear
data:
priority: 1
mode: single
The automation works fine. Only concer I have is on Home Assistant Startup. When HA start up, after a restart, sensor status is “Unknown” until next update. Whe first update happen, sensor move from “Unknown” to “Dry” and automation is fired and send the notification. In there a way to detect the “Unknown” status in automation condition, and do not fire the Automation after restart? Or there is a way to persist last sensor status over a reboot, so sensor will not became “unknown” and automation will be not fired?
Many Thanks for help
Marco