Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save veleek/06a25efffb7f0f382205aa384f22fd13 to your computer and use it in GitHub Desktop.
Save veleek/06a25efffb7f0f382205aa384f22fd13 to your computer and use it in GitHub Desktop.
blueprint:
name: Notify on Sensor Open/Close with Snooze (Notification Group)
description: Send a notification to a group when a sensor opens, clear it when it closes, and allow snoozing.
domain: automation
input:
sensor:
name: Sensor
selector:
entity:
domain: binary_sensor
notify_service:
name: Notification Service
description: The notify service to use (e.g., notify.family_phones)
selector:
text:
message_tag:
name: Message Tag
description: A unique identifier for the message to enable it to be cleared.
selector:
text:
open_message:
name: Message when open
selector:
text:
snooze_helper:
name: Snooze Helper (input_boolean)
description: Input boolean to track snooze state for this sensor
selector:
entity:
domain: input_boolean
snooze_duration:
name: Snooze Duration (minutes)
default: 10
selector:
number:
min: 1
max: 120
unit_of_measurement: minutes
trigger:
- platform: state
entity_id: !input sensor
to: 'on'
id: opened
- platform: state
entity_id: !input sensor
to: 'off'
id: closed
- platform: event
event_type: mobile_app_notification_action
event_data:
action: SNOOZE_SENSOR
id: snooze
action:
- choose:
- conditions:
- condition: trigger
id: opened
- condition: state
entity_id: !input snooze_helper
state: 'off'
sequence:
- service: !input notify_service
data:
message: !input open_message
data:
actions:
- action: SNOOZE_SENSOR
title: Snooze {{ !input snooze_duration }} min
tag: !input message_tag
push:
interruption-level: time-sensitive
- conditions:
- condition: trigger
id: closed
sequence:
- service: !input notify_service
data:
message: "clear_notification"
data:
tag: !input message_tag
- conditions:
- condition: trigger
id: snooze
sequence:
- service: input_boolean.turn_on
target:
entity_id: !input snooze_helper
- delay:
minutes: !input snooze_duration
- service: input_boolean.turn_off
target:
entity_id: !input snooze_helper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment