Hello,
I’ve been on HA just over 100 days and I slapped enough together to get me by on the leak detection and notifiers but I definitely want to finalize it with something more robust. On Hubitat, I didn’t even have to worry about this because the functionality was built in. This is what I’ve done on HA:
They’re green right now because they’re all clear. This is the custom card module and it does all kinds of dumb stuff to the icon when it gets tripped flashing/bouncing/red:
type: custom:button-card
state:
- value: 'off'
color: green
icon: mdi:water-off
- value: 'on'
icon: mdi:pipe-leak
styles:
icon:
- animation:
- twister .6s linear infinite
- blink 1s linear infinite
- color: red
card:
- animation:
- blink 1s linear infinite
extra_styles: |
@keyframes twister {
0% {transform: rotatez(0deg); top: 10px}
25% {transform: rotatez(45deg); top: 15px}
50% {top: -15px}
75% {transform: rotatez(-45deg);}
100% {transform: rotatez(0deg); top: 10px}
@keyframes flasher {
50% background
name: Refrigerator
tap_action:
action: toggle
entity: binary_sensor.refrigerator_leak_sensor
I got this blueprint that does the job in a round about way, although I know there are cleaner/better ways to do this and THIS is the part I’d like to make more robust:
alias: Leak Detection - Notifier and Shutdown
description: ''
trigger:
- platform: event
event_type: state_changed
event_data: {}
condition:
- condition: template
value_template: '{{ trigger.event.data.new_state.attributes.device_class == "moisture" }}'
- condition: template
value_template: '{{ trigger.event.data.new_state.state == "on" }}'
action:
- service: script.alexa_disable_do_not_disturb_all_devices
data: {}
- type: turn_off
device_id: dfd03c8879f516f34824e0ade307bdf8
entity_id: switch.water_supply_valve
domain: switch
- service: script.accent_lights_blue_alert
data: {}
- service: notify.mobile_app_sarge_s_phone
data:
message: >-
{{ trigger.event.data.new_state.attributes.friendly_name }} has detected
a leak.
- service: notify.mobile_app_iphone
data:
message: >-
{{ trigger.event.data.new_state.attributes.friendly_name }} has detected
a leak.
- service: notify.alexa_media
data:
target: >-
media_player.kitchen_echo_show,
media_player.2nd_floor_hallway_echo_dot,media_player.bathroom_1_echo_dot,
media_player.bedroom_2_echo_show,media_player.bedroom_echo_show,
media_player.office_echo_show,media_player.garage_entryway_echo_show,
media_player.garage_echo_dot
data:
type: announce
message: >-
{{ trigger.event.data.new_state.attributes.friendly_name }} has detected
a leak.
- service: switch.turn_off
data: {}
target:
entity_id:
- switch.adaptive_lighting_adaptive_lighting_spotlights
- switch.adaptive_lighting_adaptive_lighting_accent_lights_3rd_floor
- switch.adaptive_lighting_adaptive_lighting_accent_lights
mode: single
This watches the sensors, looks for the change, reports the change and then sets off a series of events:
Do not disturb is removed from all alexa devices (in case it happens at night)
Alexa announces the friendly name of the sensor that was tripped
HA sends a notification to my phone with the sensor that was tripped
All the accent lights in the house turn to a blue knightrider function
HA turns off the Water supply valve to the house
There’s another automation that announces to the house/sends notification that the water supply valve is turned off. This has the benefit of letting you know that a leak has been detected and threat neutralized even if I’m not at home or don’t immediately see my phone (because it will be two separate messages).
I have a water supply valve on my dashboard that does all the same dumb things the water icons do when it is in the off state. I also have it purposely where it looks like it’s off when in the on position. The reason I did this is because at night everything on my dashboard will be blue because it’s off. I don’t need an indicator telling me the water is on, I just need an aggressive indicator when the water is off.
type: custom:button-card
state:
- value: 'on'
color: var(--primary-color)
- value: 'off'
styles:
icon:
- animation:
- twister .6s linear infinite
- blink 1s linear infinite
- color: red
card:
- animation:
- blink 1s linear infinite
extra_styles: |
@keyframes twister {
0% {transform: rotatez(0deg); top: 10px}
25% {transform: rotatez(45deg); top: 15px}
50% {top: -15px}
75% {transform: rotatez(-45deg);}
100% {transform: rotatez(0deg); top: 10px}
@keyframes flasher {
50% background
tap_action:
action: toggle
entity: switch.water_supply_valve
name: Water Supply
My water supply valve on the dashboard doesn’t have any protection on it (because the announcement and the animations) but something I’ve done with other buttons that I was afraid of hitting on accident (turning on all lights in the middle of the night) I changed the tap action to a hold action. So no matter what you can make it a two click process to turn it off.
I think I have something somewhere that detects when the water supply valve has been turned on and then fixes all the lights. Do NOT rig your water supply valve to open upon leak sensor clear. I know that seems obvious but I nearly did it myself. Just because the sensor is cleared doesn’t necessarily mean the leak has been resolved so I’ve made the “alexa, turn on water supply valve” a totally independent action.
It definitely works as evidenced every few weeks when the house cleaners wipe one with a wet rag. Sometimes I think they do it because they like to see all the lights turn blue
Also, for anyone reading this. I know leak detection isn’t cool or sexy but I live in a 3 story house and this has already saved me at least 4 times. Don’t just get the leak detectors, get the water supply shut off. A lot of water can come out of a pipe in the time it takes you to get down 3 flights of stairs to manually turn off the water because you didn’t buy a $60.00 shutoff valve. It’s one of the un-fun costs of a smart home but totally worth it and once you have the sensors, you have them forever.