Skip to content

Instantly share code, notes, and snippets.

@bahuma20
Last active January 29, 2026 17:34
Show Gist options
  • Select an option

  • Save bahuma20/43b0252ab7db003961c8002b48552a2b to your computer and use it in GitHub Desktop.

Select an option

Save bahuma20/43b0252ab7db003961c8002b48552a2b to your computer and use it in GitHub Desktop.
blueprint:
name: "Fenster offen: Eskalierende Benachrichtigung"
domain: automation
input:
window_entity:
name: Fenster
selector:
entity:
domain: binary_sensor
device_class: [window, door, garage_door]
notify_devices:
name: Benachrichtigungs-Geräte
description: Wähle die Android-Geräte aus.
default: []
selector:
device:
filter:
- integration: mobile_app
multiple: true
delay_1:
name: Zeit für 1. Benachrichtigung
default: 10
selector:
number:
min: 1
max: 120
unit_of_measurement: minutes
delay_2:
name: Zeit für 2. Benachrichtigung
default: 20
selector:
number:
min: 1
max: 120
unit_of_measurement: minutes
msg_1:
name: Text 1. Benachrichtigung
default: "Das Fenster im {{ room_name }} ist offen."
selector:
text:
msg_2:
name: Text 2. Benachrichtigung
default: "ACHTUNG: Das Fenster im {{ room_name }} ist schon lange offen!"
selector:
text:
trigger:
- platform: state
entity_id: !input window_entity
to: "on"
for:
minutes: !input delay_1
id: "escalation_1"
- platform: state
entity_id: !input window_entity
to: "on"
for:
minutes: !input delay_2
id: "escalation_2"
- platform: state
entity_id: !input window_entity
to: "off"
id: "closed"
action:
- variables:
window_entity: !input window_entity
window_name: "{{ state_attr(window_entity, 'friendly_name') }}"
room_name: "{{ area_name(window_entity) | default(window_name) }}"
notify_tag: "window_alert_{{ window_entity }}"
devices: !input notify_devices
text_1: !input msg_1
text_2: !input msg_2
- repeat:
for_each: "{{ devices }}"
sequence:
- variables:
# Generiert den Service-Namen aus der Device ID (z.B. notify.mobile_app_pixel_9)
service_name: "notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify }}"
- choose:
- conditions: "{{ trigger.id == 'escalation_1' }}"
sequence:
- action: "{{ service_name }}"
data:
title: "Fenster offen"
message: "{{ text_1 }}"
data:
tag: "{{ notify_tag }}"
sticky: "true"
channel: "Fenster"
icon: "mdi:window-open-variant"
notification_icon: "mdi:window-open-variant"
- conditions: "{{ trigger.id == 'escalation_2' }}"
sequence:
- action: "{{ service_name }}"
data:
title: "Fenster Alarm!"
message: "{{ text_2 }}"
data:
tag: "{{ notify_tag }}"
sticky: "true"
priority: "high"
ttl: 0
channel: "Fenster Alarm"
icon: "mdi:alert-octagram-outline"
notification_icon: "mdi:alert-octagram-outline"
- conditions: "{{ trigger.id == 'closed' }}"
sequence:
- action: "{{ service_name }}"
data:
message: "clear_notification"
data:
tag: "{{ notify_tag }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment