Automations / Home Assistant 2026.8

Water-leak alert

A persistent Home Assistant warning and an immediate phone notification when water is detected.

Starter10 minNo HACS requiredVerified syntax
Replace your entities
01

Outcome

Build a dual local and mobile alert with a stable ID that prevents duplicate dashboard notices.

02

Before you start

  • A leak binary_sensor whose state is on when wet.
  • The Companion app connected with notifications allowed.
  • Your phone’s exact notify.mobile_app action name.

02 / Workflow

Guided installation

Follow the steps in order. The configurator below generates the block you need to paste.

  1. 01

    Create an empty automation

    Go to Settings → Automations & scenes, create a new automation, and choose the empty option.

  2. 02

    Open the YAML editor

    From the top-right menu, select Edit in YAML.

  3. 03

    Configure and paste

    Enter entities, thresholds, and labels below, then replace the existing YAML.

  4. 04

    Save and test

    Save, use Run actions for a controlled test, and inspect Traces after a real trigger.

YAML configurator

Replace your entities

Enter the real entity IDs from your installation. The code updates immediately and flags invalid values.

Valid configuration
Generated code
alias: "Safety · water leak"
description: ""
triggers:
  - trigger: state
    entity_id: binary_sensor.perdita_acqua_lavatrice
    from: "off"
    to: "on"
conditions: []
actions:
  - action: persistent_notification.create
    data:
      notification_id: perdita_acqua_lavatrice
      title: "Water leak alert"
      message: "Water was detected near the washing machine. Check it now."
  - action: notify.mobile_app_telefono
    data:
      title: "Water leak alert"
      message: "Water was detected near the washing machine. Check it now."
mode: single

Entity map

Where to find entity IDs and actions

  1. 01

    Open Settings → Devices & services → Entities.

  2. 02

    Find the device and copy its full ID, such as sensor.living_room_temperature.

  3. 03

    For notifications, open Settings → Developer tools → Actions and search for notify.mobile_app.

  4. 04

    Paste each value into the matching field and copy the YAML only when every check is green.

Source first

Official references

The syntax and components in this project were checked against these Home Assistant pages.

01home-assistant.io · automation / yaml02home-assistant.io · integrations / persistent_notification03companion.home-assistant.io · notifications / notifications basic
Tested with: Home Assistant 2026.8 · 2026-08-23