Last active
October 11, 2025 14:40
-
-
Save schiberis/022c6ca8308580e9577e50670dc08d6b to your computer and use it in GitHub Desktop.
Sends mobile push and/or HA UI persistent notifications with minimal controls. No siren/switch options.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| blueprint: | |
| name: Water Leak Alarm β mobile + HA UI notifications (modern syntax) | |
| description: > | |
| IKEA BADRING (or any wet/dry sensor). Choose mobile push and/or | |
| HA UI (persistent) notifications. Minimal, future-proof syntax. | |
| domain: automation | |
| input: | |
| leak_sensor: | |
| name: Leak sensor entity | |
| description: "Select your BADRING entity (binary_sensor or sensor)." | |
| selector: | |
| entity: | |
| multiple: false | |
| notify_service: | |
| name: Notify service | |
| description: "e.g., notify.notify or notify.mobile_app_<your_phone>" | |
| default: notify.notify | |
| selector: | |
| text: | |
| # Choose notification types | |
| enable_mobile: | |
| name: Enable mobile push notifications | |
| description: "Send push notifications via the selected notify service." | |
| default: true | |
| selector: | |
| boolean: {} | |
| enable_persistent: | |
| name: Enable HA UI notifications | |
| description: "Create persistent notifications (bell icon in Home Assistant)." | |
| default: true | |
| selector: | |
| boolean: {} | |
| # Titles / messages | |
| wet_title: | |
| name: Leak detected β title | |
| default: "π¨ Water leak detected" | |
| selector: | |
| text: | |
| wet_message: | |
| name: Leak detected β message | |
| default: > | |
| Leak detected by {{ state_attr(leak_entity, 'friendly_name') or leak_entity }} | |
| at {{ now() | as_timestamp | timestamp_custom('%Y-%m-%d %H:%M:%S') }}. | |
| selector: | |
| text: | |
| multiline: true | |
| clear_title: | |
| name: Leak cleared β title | |
| default: "β Water leak cleared" | |
| selector: | |
| text: | |
| clear_message: | |
| name: Leak cleared β message | |
| default: > | |
| Leak cleared for {{ state_attr(leak_entity, 'friendly_name') or leak_entity }} | |
| at {{ now() | as_timestamp | timestamp_custom('%Y-%m-%d %H:%M:%S') }}. | |
| selector: | |
| text: | |
| multiline: true | |
| mode: restart | |
| max_exceeded: silent | |
| trigger: | |
| - platform: state | |
| entity_id: !input leak_sensor | |
| action: | |
| # --- Modern-syntax variables: local to this run --- | |
| - variables: | |
| leak_entity: !input leak_sensor | |
| ns: !input notify_service | |
| enable_mobile: !input enable_mobile | |
| enable_persistent: !input enable_persistent | |
| wet_title: !input wet_title | |
| wet_message: !input wet_message | |
| clear_title: !input clear_title | |
| clear_message: !input clear_message | |
| # Current state (normalized) | |
| state_str: >- | |
| {% if trigger and trigger.to_state %} | |
| {{ trigger.to_state.state | lower }} | |
| {% else %} | |
| {{ states(leak_entity) | lower }} | |
| {% endif %} | |
| # Classify states | |
| is_wet: >- | |
| {% set wet_vals = ['on','wet','leak','leaking','detected','alarm','true','1'] %} | |
| {{ state_str in wet_vals }} | |
| is_clear: >- | |
| {% set clr_vals = ['off','dry','clear','ok','idle','false','0'] %} | |
| {{ state_str in clr_vals }} | |
| # Stable, per-sensor IDs so wet/clear never overwrite each other | |
| pn_id_wet: >- | |
| {{ ('leak_ui_' ~ leak_entity ~ '_wet') | replace('.', '_') | replace(' ', '_') }} | |
| pn_id_clear: >- | |
| {{ ('leak_ui_' ~ leak_entity ~ '_clear') | replace('.', '_') | replace(' ', '_') }} | |
| # ------------------- | |
| # Leak detected (WET) | |
| # ------------------- | |
| - if: "{{ is_wet }}" | |
| then: | |
| # Mobile push (optional) | |
| - if: "{{ enable_mobile | bool }}" | |
| then: | |
| - service: "{{ ns }}" | |
| data: | |
| title: "{{ wet_title }}" | |
| message: "{{ wet_message }}" | |
| # HA UI persistent (optional) | |
| - if: "{{ enable_persistent | bool }}" | |
| then: | |
| - service: persistent_notification.create | |
| data: | |
| title: "{{ wet_title }}" | |
| message: "{{ wet_message }}" | |
| notification_id: "{{ pn_id_wet }}" | |
| # ------------------- | |
| # Leak cleared (DRY) | |
| # ------------------- | |
| - if: "{{ is_clear }}" | |
| then: | |
| # Mobile push (optional) | |
| - if: "{{ enable_mobile | bool }}" | |
| then: | |
| - service: "{{ ns }}" | |
| data: | |
| title: "{{ clear_title }}" | |
| message: "{{ clear_message }}" | |
| # HA UI persistent (optional) | |
| - if: "{{ enable_persistent | bool }}" | |
| then: | |
| - service: persistent_notification.create | |
| data: | |
| title: "{{ clear_title }}" | |
| message: "{{ clear_message }}" | |
| notification_id: "{{ pn_id_clear }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment