Skip to content

Instantly share code, notes, and snippets.

@dkedinger
Created April 28, 2026 02:44
Show Gist options
  • Select an option

  • Save dkedinger/6129ba612de18ed4d562cc2995a9dc5d to your computer and use it in GitHub Desktop.

Select an option

Save dkedinger/6129ba612de18ed4d562cc2995a9dc5d to your computer and use it in GitHub Desktop.
Triggered by one or more leak sensors. Sends push notifications and plays TTS on selected speakers if residents are home. The triggering sensor's friendly name is included in all alerts.
blueprint:
name: Leak Alert (Multi-Sensor)
description: >
Triggered by one or more leak sensors. Sends push notifications and plays
TTS on selected speakers if residents are home. The triggering sensor's
friendly name is included in all alerts.
── VARIABLES AVAILABLE IN CUSTOM ACTIONS ──
Switch any field to Template mode and use:
{{ sensor_name }} — friendly name of the sensor that triggered
{{ full_tts_message }} — the full spoken message string
{{ is_critical }} — true/false based on the Critical toggle below
domain: automation
input:
leak_sensor:
name: Water Leak Sensors
description: Select one or more moisture sensors to monitor.
selector:
entity:
domain:
- binary_sensor
device_class:
- moisture
multiple: true
notify_targets:
name: Mobile Devices (Optional)
description: >
Select one or more phones or tablets to notify. Only devices with the
Home Assistant companion app installed will appear here.
default: []
selector:
device:
integration: mobile_app
multiple: true
critical_notification:
name: Critical Notification
description: >
When enabled, notifications bypass Do Not Disturb on iOS and Android.
iOS sends a critical alert at full volume. Android routes through the
high-priority alarm stream.
default: false
selector:
boolean: {}
custom_actions:
name: Custom Actions (Optional)
description: >
Any additional actions to run after notifications — flash lights,
close a valve, etc. The variables {{ sensor_name }},
{{ full_tts_message }}, and {{ is_critical }} are available in
any template field. Leave empty to skip.
default: []
selector:
action: {}
people_to_check:
name: Residents (Presence Check)
description: TTS will only play if one or more of these people are home.
default: []
selector:
entity:
domain:
- person
multiple: true
speakers:
name: TTS Speakers
description: Select one or more media players for the audio warning.
selector:
entity:
domain:
- media_player
multiple: true
tts_engine:
name: TTS Engine
description: >
Select your TTS engine entity. Use tts.cloud if you have Nabu Casa.
If unavailable at runtime the automation will automatically fall back
to tts.google_translate which is built into every Home Assistant install.
default: tts.cloud
selector:
entity:
domain:
- tts
tts_message:
name: TTS Audio Message
description: >
The alert message spoken aloud. The triggering sensor's name is
automatically prepended: "Warning. [Sensor Name]. [Your message]"
default: Water leak detected. Please check immediately.
selector:
text:
multiline: false
variables:
people_var: !input people_to_check
tts_base: !input tts_message
is_critical: !input critical_notification
tts_engine_var: !input tts_engine
sensor_name: "{{ trigger.to_state.name }}"
full_tts_message: "Warning. {{ trigger.to_state.name }}. {{ tts_base }}"
resolved_tts_engine: >
{% if states(tts_engine_var) not in ['unavailable', 'unknown', 'none'] %}
{{ tts_engine_var }}
{% else %}
tts.google_translate
{% endif %}
trigger:
- platform: state
entity_id: !input leak_sensor
to: "on"
from: "off"
for:
seconds: 5
action:
# Mobile push notifications
- if:
- condition: template
value_template: "{{ (notify_targets | default([])) | count > 0 }}"
then:
- repeat:
for_each: !input notify_targets
sequence:
- action: notify.send_message
target:
device_id: "{{ repeat.item }}"
data:
title: "💦 Leak Detected — {{ sensor_name }}"
message: "{{ full_tts_message }}"
data:
push:
sound:
name: default
critical: "{{ 1 if is_critical else 0 }}"
volume: 1.0
channel: "{{ 'alarm_stream' if is_critical else 'default' }}"
importance: "{{ 'high' if is_critical else 'default' }}"
# Custom actions
- choose: []
default: !input custom_actions
# TTS if residents are home
- if:
- condition: template
value_template: >
{{ expand(people_var) | selectattr('state', 'eq', 'home') | list | count > 0 }}
then:
- action: tts.speak
target:
entity_id: "{{ resolved_tts_engine }}"
data:
cache: false
language: en-US
message: "{{ full_tts_message }}"
media_player_entity_id: !input speakers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment