Water Leaks and Shut Off Valve Management - Looking for inspiration / ideas / examples

I am in the process of designing a dashboard to handle my leak sensors and shut off valves and am seeking inspiration and ideas on best practices and layout.

This is a plain list of what I am dealing with:

This is what I would like to achieve (some of which I already have):

  1. Large blinking icons telling me there is a leak. I have those on the water leak tab and also on my main dashboard.
  2. Restricted toggling of the water valves to avoid accidental toggling. Currently using Restriction card but I believe the button card also has restriction abilities. I am tempted to move to that to consolidate.
  3. Alerts sent to phone and played on a few Echos in the house. Alerts tell you what sensor triggered the alarm and both start / stop events.
  4. Display a log on the water leak tab with last events, including leaks, water detection (for HVAC pans), and valve changes of state. I do not have this yet and am not sure on the best approach.
  5. Low battery and offline sensors / valves alerts (don’t have and this caused me not to notice nearly overflowing HVAC pan a couple summers ago… I saw the drip from the overflow pipe outside the house… it could have been really bad thanks to HVAC systems being in the attic…)

What have you done with yours?

Wow. I’ve only got a Dishwasher Leak Sensor and a Water Heater Leak Sensor… but I will be watching this thread with interest.

Recently, I came home in the middle of the day to lock my dog inside (before the gardeners arrived), and when I went through the garage entrance, I noticed some water around the bottom of my steps and a wet area at the bottom of some particle board I recently installed to replace some drywall. Turns out my 16 year old Water Heater was done… leaking into the garage cabinet it was in. Caught it just in time.

I shut the valve off above it, grabbed a garden hose and hooked it to the drain. Returned to work in my truck (instead of my tiny smart car), because I knew I was going to have to replace that water heater immediately… I don’t like cold showers at all. $1066.30 later, I brought home another 50 Gallon Gas Fired water heater with the same 9-year warranty as the last one… that I got 16 years out of. Mind you, I did replace 3 dishwashers in the same period, so the water heater lifespan is miraculous… our water is so hard locally that you can slice it off with a knife as it comes out of the hose.

At least now I have a sensor at the bottom, but I’d really like to install a valve as well. So I’m watching this thread. Thank you.

Jim in Hollister

1 Like

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.
2022-05-01 13_25_49-Greenshot

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 :grin:

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.

2 Likes

@JmartinHA My leak sensors have saved me multiple times. I’ve had 3 leaks under the sink that were small and were detected before any damage happened. I also had a water sensor in the pan under my water heater and detected it leaking within minutes of it starting. My water heater was only 6 years old, and was in the attic so it would have done thousands in damage if the water overflowed the pan. I now have a Navien tankless water heater and couldn’t be happier… well I would be happier if I could integrate it into HA but was not using HA yet when I installed it. Either way I am using a Zooz Titan Water Valve Actuator to cut water off to the water heater if any leak is detected. The Titan itself has a wired sensor and can operate regardless of the automation system, but I also have a Zigbee sensor. I use the same actuator on the whole house water shut off I installed in my garage (temporary solution as I will mount everything to the wall and add bypasses for water softener and self washing water filter). In summary… the sensors and Titans were well worth the cost!

1 Like

@Sergeantpup You reminded me that I did not implement anything to alert me of a leak during the night… I mean I get the alert but I won’t hear it as my phone won’t disturb me and the Echos that typically warn me of the leaks are office, kitchen and living room… which I will not hear.

My house did not have a whole house water shut off that I could automate as it is in the yard below ground level. I added a shut off valve in line with my water softener while I plan out a more permanent solution. Mostly I have to pick the parts and finalize the size of it all.

All my automations are done exclusively in Node Red! If you have not tried it, I warmly recommend doing so! It is addictive and super powerful! I agree that the water shut off valve should never be opened automatically, and I take it a step more by ensuring it cannot be opened/closed by Alexa either as she often hears one thing for another… but maybe I can revisit that once I have a more solid notification solution.

On my main dashboard, organized in 3 columns so it works well both on large screens and mobile, I have intrusion, fire and water alarms. I too use the button-card (love it!!) and I just triggered it for this screenshot. It pulses in and out in red when a leak is detected. If you tap it, it takes you to my Safety dashboard (still being built).


(Edit: updated image as I updated all buttons to have their own safety related purpose)

Yeah… this solution requires 2 taps to get to where the sensors and valves are but I figured it is a rare event so not too much trouble. The blinking red won’t stop until you reset it manually. When you click the blinking icon, it will ask if you are sure you want to acknowledge it (mostly to ensure one doesn’t reset it by mistake).

I really need to have a log of what sensor triggered the alarm though as I sometimes clear notifications on my phone without paying attention…

1 Like

I used node red to handle all my grafana stuff on Hubitat. When I moved to HA, it was just “get everything working and stable” and I didn’t want to add the complexity of node red to the mix as I was learning HA. I definitely don’t have any logging because of the notifications and announcements but I can definitely see the value in it. I need to get a more robust solution for leaks now that my home is stable. I’m gonna hang out and see what other people come up with. It always surprised me how little info was on the HA forums about leak stuff; I appreciate a more recent conversation about the topic.

2 Likes

I made some progress. I split my 2 water sensors installed in the HVAC water pans from all my leak sensors as the urgency between the two is different. In the sub panel showing all the water related stuff I have two alarms to distinguish between the two however on the main dashboard for the home, it is now a generic “Water Alarm”

Main dashboard:

Water Alarm dashboard:


(Edit: Ignore the “by Alex” that was me forcing sensors for testing purposes)

The dashboard is not finished as I don’t like the poor readability of the log, and the batteries card title won’t resize properly (more on this here: Style formatting title works in preview but not once saved. Why?)

One enhancement I need to add is some sort of alert for sensors that go offline or that have low batteries. I have had a couple cases or more of leaks that did not get reported due to one of the above. One of them could have been pretty bad as the water pan under one of my HVAC systems was about to overflow (it was positioned improperly so the drain was not doing much) and it is in my attic (read tons of drywall repair).

I am not a fan of how it looks but the dashboard is arranged like this so it will work both on mobile and desktops… therefore all the alarms, log and valve control need to be on the 1st column at the top. The two sets of identical buttons on the very top is something I am still experimenting with… they are navigation buttons to go back to the upper level main dashboards.

Note: The shut off valves have a wet/dry status as they have their own wired water sensors which shuts off the water even without automation.

I overhauled my automations for this last week and it has already saved me. A leak was detected at the kitchen sink this morning. Also, everything works as intended!

1 Like

Question – is there a way to programmatically define a custon button card and then replicate it but only changing the entity? If not, having 10s of different sensors – are you replicating the button card 10s of times, with the animation and everything else?
I really want to avoid that because say I decide I want to change the colors or the animation slightly, it means now I need to update 10s of button cards instead of changing one place and it being automatically updated everywhere.

I hope my question made sense…

Your question makes sense and I understand it but I don’t know the answer. I haven’t looked at front end stuff in over a year. I’m sure somebody has figured it out, we just have to find the use case.

Great stuff, I will try and implement what you have made in my HA as well.

Question : shouldn’t you have an override in the script in case the smoke or fire alarm goes off? You don’t want your water supply to shut down while you are putting out the fire because the water tripped a water leak sensor. Just a thought…

I have 5 fire extinguishers around the house so I am more likely to use one of those but I need to fully evaluate all circumstances as you made a very good point. It probably wouldn’t hurt to just do it anyway however my Nest Protect integration is so unreliable (all because of Google) that might cause the valve not to operate during a more common (vs fire with leak) water leak event. I have also been considering turning off both HVAC systems completely in the event of a smoke alarm to avoid spreading it… I will probably just implement both if I can ensure it will never cause my valves not to close when I really need them to.