Skip to content

Instantly share code, notes, and snippets.

@bbbenji
Last active December 29, 2023 14:09
Show Gist options
  • Save bbbenji/6119ca14cad765b03ef4d41d52307688 to your computer and use it in GitHub Desktop.
Save bbbenji/6119ca14cad765b03ef4d41d52307688 to your computer and use it in GitHub Desktop.
blueprint:
name: Enhanced Leak Detection & Notifier
description: Send a notification when any configured moisture sensor detects a leak.
domain: automation
input:
moisture_sensors:
name: Moisture Sensors
description: "Select moisture sensors to monitor."
selector:
entity:
domain: binary_sensor
device_class: moisture
notify_device:
name: Notify Device
description: "The device where the notification should be sent."
selector:
device:
integration: mobile_app
trigger:
- platform: state
entity_id: !input moisture_sensors
to: "on"
attribute: device_class
condition:
- condition: template
value_template: "{{ state_attr(trigger.entity_id, 'device_class') == 'moisture' }}"
action:
- alias: "Send Notification"
domain: mobile_app
type: notify
device_id: !input notify_device
message: >
{{ state_attr(trigger.entity_id, 'friendly_name') | default('A sensor') }} detected a leak at {{ now().strftime('%Y-%m-%d %H:%M:%S') }}.
title: "Leak Detected!"
mode: single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment