---
title: "A leak under the sink: a notification that repeats until it dries"
description: "A leak sensor under the sink sends a notification to your phones and repeats it every 10 minutes until all the sensors are dry. The water is not shut off automatically: the automation only warns."
canonical: "https://realhomeautomations.com/en/projects/leak-under-sink-repeating-notification/"
language: en-US
updated: 2026-11-23T16:24:04+00:00
---

# A leak under the sink: a notification that repeats until it dries

A leak sensor under the sink sends a notification to your phones and repeats it every 10 minutes until all the sensors are dry. The water is not shut off automatically: the automation only warns.

> Canonical HTML page: https://realhomeautomations.com/en/projects/leak-under-sink-repeating-notification/

- **Difficulty:** Beginner
- **Build time:** 20–40 minutes
- **Reading time:** 5 minutes

## Tools required

- A leak sensor added to Home Assistant (a binary_sensor with the moisture class, for example the Sonoff SNZB-05P over Zigbee (ZHA or Zigbee2MQTT). You need a Zigbee hub or Home Assistant with a Zigbee adapter.)
- Phone with Home Assistant Companion (notifications must be allowed; critical on iOS)


## What readers will learn

- Check that the leak sensor changes its state to on with water and returns to off
- Send a test notification to more than one phone
- Make an automation that repeats the notification every 10 minutes until the sensors dry
- Know what this automation does not do: it does not shut off the water and does not see an unavailable sensor


## Skill requirements

- Add a Zigbee device in Home Assistant
- Paste YAML into the automation editor
- Send a test notification through Developer tools

## Project kit

- [Flood sensor Sonoff SNZB-05P, with flood detection cable included](https://realhomeautomations.com/en/product/flood-sensor-sonoff-snzb-05p-with-flood-detection-cable-included/index.md)

**TL;DR:** A leak sensor under the sink sends a notification to your phones and repeats it every 10 minutes until all the sensors are dry. The water is not shut off automatically: the automation only warns.

 A leak under the sink starts with a drop and is usually noticed when the cabinet is already wet. A sensor on the floor catches it earlier, but it only helps if someone hears the notification. That is why the notification here is not a single one, but repeats.

 ## How it works

 Three water sensors watch three places. The automation in Home Assistant fires when any of them shows "wet" (`on`) for 5 seconds in a row.

 Then it sends a notification to the phones with the names of the wet places, waits 10 minutes and sends again. It repeats until all three sensors show "dry" (`off`). On iOS the notification is critical: it sounds even when Do Not Disturb is on.

 The automation does not touch the valve and does not stop appliances. Shutting off the water stays manual.

 There is also a variant without Home Assistant. The sensor manufacturer's app sends one notification on detection. The repetition and the critical sound come from Home Assistant.

 ## 1. Choose and add a sensor

 You need a sensor that Home Assistant shows as `binary_sensor` with the class `moisture`. We watch three places with three leak sensors. The shop has the [Sonoff SNZB-05P](https://realhomeautomations.com/bg/produkt/flood-sensor-sonoff-snzb-05p-with-flood-detection-cable-included/): a Zigbee 3.0 leak sensor with the sensing cable included. It is added to Home Assistant through ZHA or Zigbee2MQTT. You need a Zigbee hub or Home Assistant with a Zigbee adapter.

 Put the sensor in pairing mode following its instructions and add it through ZHA or Zigbee2MQTT. After adding it, put it where water would collect first: on the floor under the sink, behind the washing machine or next to the water heater.

 ## 2. Check that the sensor changes state

 Open **Settings → Devices & services → Entities** and find the `binary_sensor` of the sensor. A dry sensor is `off`.

 Wet the cable or the sensor's contacts with a finger. The state should become `on` within seconds. Dry it, and it should go back to `off`. If the state is `unavailable`, the sensor is not communicating and the automation has no way to see it.

 Write down the identifiers of all the sensors. The examples below use ours: `binary_sensor.closet_water_leak`, `binary_sensor.below_sink_water_leak` and `binary_sensor.under_kitchen_cabinets_water_leak_flood`.

 ## 3. Check the notifications to the phones

 Open **Developer tools → Actions** and find the action `notify.mobile_app_…` of each phone. Send a test message and check that it arrives.

 On iOS the critical notification is turned on from the Companion app settings, and then it sounds even with the sound off. On Android the critical behavior is set another way. See the Companion documentation below and test on your own phone.

 ## 4. Create the automation

 Open **Settings → Automations & scenes → Create automation → Create new automation**. From the three-dot menu choose **Edit in YAML** and replace the content with the example. Replace all `entity_id` with your sensors and `notify.mobile_app_telefon_1` and `notify.mobile_app_telefon_2` with the actions of your phones.

 The example is our "Critical water leak alerts" automation with neutral phone names. The sound block `push` is for iOS.

 ```
alias: "Critical water leak alerts"
description: "Repeats a notification to both phones until all the sensors are dry."
mode: single
triggers:
  - trigger: state
    entity_id:
      - binary_sensor.closet_water_leak
      - binary_sensor.below_sink_water_leak
      - binary_sensor.under_kitchen_cabinets_water_leak_flood
    to: "on"
    for: "00:00:05"
conditions: []
variables:
  wet_sensors: >-
    {% set ns = namespace(sensors=[]) %}
    {% if is_state('binary_sensor.closet_water_leak', 'on') %}
      {% set ns.sensors = ns.sensors + ['in the wardrobe room'] %}
    {% endif %}
    {% if is_state('binary_sensor.below_sink_water_leak', 'on') %}
      {% set ns.sensors = ns.sensors + ['under the sink'] %}
    {% endif %}
    {% if is_state('binary_sensor.under_kitchen_cabinets_water_leak_flood', 'on') %}
      {% set ns.sensors = ns.sensors + ['under the kitchen cabinets'] %}
    {% endif %}
    {{ ns.sensors | join(', ') }}
actions:
  - repeat:
      until:
        - condition: template
          value_template: >-
            {{ is_state('binary_sensor.closet_water_leak', 'off')
               and is_state('binary_sensor.below_sink_water_leak', 'off')
               and is_state('binary_sensor.under_kitchen_cabinets_water_leak_flood', 'off') }}
      sequence:
        - action: notify.mobile_app_telefon_1
          data:
            title: "Water leak!"
            message: "Water detected: {{ wet_sensors }}. Check immediately!"
            data:
              push:
                sound:
                  name: default
                  critical: 1
                  volume: 1
        - action: notify.mobile_app_telefon_2
          data:
            title: "Water leak!"
            message: "Water detected: {{ wet_sensors }}. Check immediately!"
            data:
              push:
                sound:
                  name: default
                  critical: 1
                  volume: 1
        - delay: "00:10:00"
```

 Save the automation and check that it is on.

 ## Test it

 Turn on the automation and wet the cable or contacts of one sensor with a finger. After 5 seconds you should get a notification on both phones with the place of the sensor.

 Leave the sensor wet. A notification should come every 10 minutes. Dry all the sensors and the repetitions stop. See the **Settings → Automations & scenes**, open the automation and in **Traces** check the last run.

 Edge case: if a second sensor gets wet while the first is still wet, the automation does not start a new cycle, because it is in mode `single`. The list of places is calculated once, at the start, and will not add the second place. The notifications continue, but the text keeps the old place.

 ## When a sensor goes quiet

 The leak sensor runs on a battery and can only alert you while it has power. If the battery runs out or the sensor drops off the network, Home Assistant shows it as "unavailable" and the critical leak alert can no longer arrive. So we add a second automation: if any sensor is "unavailable" for more than an hour, or its battery drops below 20 %, the phones get a normal notification with the sensor's name. You change the battery in time, not after the water is already on the floor.

 ```
alias: "Leak sensor offline or low battery"
description: "Normal notification when a leak sensor has not responded for an hour or its battery is below 20 %."
mode: queued
triggers:
  - trigger: state
    entity_id:
      - binary_sensor.closet_water_leak
      - binary_sensor.below_sink_water_leak
      - binary_sensor.under_kitchen_cabinets_water_leak_flood
    to: "unavailable"
    for: "01:00:00"
    id: offline
  - trigger: numeric_state
    entity_id:
      - sensor.closet_water_leak_battery
      - sensor.below_sink_water_leak_battery
      - sensor.under_kitchen_cabinets_water_leak_battery
    below: 20
    id: battery
conditions: []
actions:
  - action: notify.mobile_app_telefon_1
    data:
      title: "Leak sensor"
      message: >-
        {% if trigger.id == 'offline' %}
          {{ trigger.to_state.name }} has not responded for an hour. Check the battery and the connection.
        {% else %}
          {{ trigger.to_state.name }}: battery at {{ trigger.to_state.state }} %. Replace it soon.
        {% endif %}
  - action: notify.mobile_app_telefon_2
    data:
      title: "Leak sensor"
      message: >-
        {% if trigger.id == 'offline' %}
          {{ trigger.to_state.name }} has not responded for an hour. Check the battery and the connection.
        {% else %}
          {{ trigger.to_state.name }}: battery at {{ trigger.to_state.state }} %. Replace it soon.
        {% endif %}
```

 ## If it doesn't work

- **There is no notification and the sensor is `unavailable`.** Check the battery and the signal. The automation fires only on a transition to `on`, and an unavailable sensor does not reach it.
- **The notifications don't stop although there is no water.** The condition requires all three sensors to be exactly `off`. If one is `unavailable`, the condition is never true and the loop goes on. Fix or remove the unavailable sensor. You can replace the condition with `{{ not (is_state('binary_sensor.closet_water_leak', 'on') or is_state('binary_sensor.below_sink_water_leak', 'on') or is_state('binary_sensor.under_kitchen_cabinets_water_leak_flood', 'on')) }}`.
- **The notification is silent.** Check whether critical notifications are allowed in the Companion app and whether the phone receives a test message at all from **Developer tools → Actions**.

 ## Limitations

 The sensor does not detect water that doesn't reach its cable or contacts. The notification depends on Home Assistant, on the internet for push and on the phone. A Home Assistant restart interrupts the repetition and does not resume it.

 An unavailable sensor does not raise an alarm.

 This automation does not shut off the water automatically.

 ## Next project

 If you watch the washing machine, which is often the cause of a leak, see [a notification when the washing machine is done](/bg/projects/peralnyata-priklyuchi-izvestie-po-konsumatsiyata-na-tok/).

 ## Sources and status

 The "Critical water leak alerts" automation is on in Marto's Home Assistant. The material was checked against its configuration and the documentation.

- [Home Assistant: State trigger](https://www.home-assistant.io/docs/automation/trigger/#state-trigger)
- [Home Assistant: Repeat](https://www.home-assistant.io/docs/scripts/#repeat-a-group-of-actions)
- [Home Assistant: Automation modes](https://www.home-assistant.io/docs/automation/modes/)
- [Home Assistant: Binary sensor](https://www.home-assistant.io/integrations/binary_sensor/)
- [Home Assistant: ZHA](https://www.home-assistant.io/integrations/zha/)
- [Companion: Critical notifications](https://companion.home-assistant.io/docs/notifications/critical-notifications/)