Skip to content

Instantly share code, notes, and snippets.

@YusDyr
Last active October 8, 2024 00:35
Show Gist options
  • Save YusDyr/cbc68e3da4b77372b070e9c2857903e0 to your computer and use it in GitHub Desktop.
Save YusDyr/cbc68e3da4b77372b070e9c2857903e0 to your computer and use it in GitHub Desktop.
blueprint:
name: Leak Detection & Notifier
description: Send notifications when any configured moisture sensor detects moisture.
domain: automation
input:
# Notification for Mobile Devices
notify_mobile:
name: Notify Mobile Device
description: Select the mobile device to send the notification to.
selector:
device:
integration: mobile_app
# Notification for Yandex Smart Speaker
notify_yandex:
name: Notify Yandex Smart Speaker
description: Select the Yandex smart speaker to send the notification to.
selector:
device:
integration: media_player
# Notification for Telegram
notify_telegram:
name: Notify Telegram
description: Select the Telegram notifier to send the notification to.
selector:
entity:
domain: notify
trigger:
- event_data: {}
event_type: state_changed
platform: event
condition:
- condition: template
#
# value_template: {{ trigger.to_state.attributes.device_class == "moisture" }}
value_template: '{{ trigger.event.data.new_state.attributes.device_class == "moisture" }}'
- condition: template
value_template: '{{ trigger.event.data.new_state.state == "on" }}'
action:
# Notify Mobile Device if selected
- choose:
- conditions:
- condition: template
value_template: '{{ notify_mobile is not none }}'
sequence:
- service: notify.{{ notify_mobile }}
data:
title: "🔔 Leak Detected!"
message: >
{{ trigger.to_state.attributes.friendly_name }} has detected a leak.
# Notify Yandex Smart Speaker if selected
- choose:
- conditions:
- condition: template
value_template: '{{ notify_yandex is not none }}'
sequence:
- service: notify.yandex_smart_speaker # **Replace with your actual Yandex notifier service**
entity_id: media_player.yandex_station_mini
action: media_player.play_media
data:
media_content_id: <speaker voice="zahar">Ахтунг, у нас протечка!
media_content_type: dialog
# Notify Telegram if selected
- choose:
- conditions:
- condition: template
value_template: '{{ notify_telegram is not none }}'
sequence:
- service: notify.telegram_notifier # **Replace with your actual Telegram notifier service**
data:
title: "🔔 *ПРОТЕЧКА!!!* 💦"
message: >
Сработал датчик протечки {{ trigger.to_state.attributes.friendly_name }} {{ now().strftime("%A, %d %B %Y %H:%M:%S") }}!`
mode: single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment