Skip to content

Instantly share code, notes, and snippets.

@curreta
Created April 8, 2025 03:40
Show Gist options
  • Save curreta/0026df3340c1b0adc0767238aae7c0bc to your computer and use it in GitHub Desktop.
Save curreta/0026df3340c1b0adc0767238aae7c0bc to your computer and use it in GitHub Desktop.
HA - HM - MS
blueprint:
name: Make Sure - ADHD Smart Alert System
description: >
# Make Sure: ADHD-Optimized Smart Alert System
An intelligent notification system designed for ADHD cognition that understands
urgency, context, and individual response patterns. It integrates with home
automation, mobile devices, and wearables to ensure critical events aren't missed
while preventing alert fatigue.
## Core Features:
- Contextual awareness (location, time of day, devices in use)
- Progressive escalation based on event type and response patterns
- Multi-channel delivery through home automation and personal devices
- Smart retry system for unacknowledged alerts
- Social accountability integration with trusted contacts
domain: automation
input:
calendar_entity:
name: Calendar
description: The calendar entity to monitor for events
selector:
entity:
domain: calendar
event_keyword:
name: Event Keyword (Optional)
description: >
Optional keyword that must be present in calendar events to trigger this system.
Leave empty to include all calendar events.
default: ""
selector:
text:
event_type:
name: Event Type
description: >
Choose whether this event has strict timing or flexible window timing.
Strict events will have more aggressive pre-event notifications.
default: strict
selector:
select:
options:
- label: Strict-time Event (meetings, appointments, etc.)
value: strict
- label: Flexible-window Event (medication, tasks, etc.)
value: flexible
flexible_window:
name: Flexible Window Duration (for Flexible Events)
description: How long the window remains open for flexible events
default: 60
selector:
number:
min: 15
max: 240
unit_of_measurement: minutes
primary_device:
name: Primary Notification Device
description: Your primary mobile device for notifications
selector:
device:
integration: mobile_app
backup_devices:
name: Backup Notification Devices (Optional)
description: Additional devices that will receive escalated notifications
default: []
selector:
device:
integration: mobile_app
multiple: true
trusted_contact:
name: Trusted Contact Device (Optional)
description: Device for your accountability partner/trusted contact
default: []
selector:
device:
integration: mobile_app
multiple: true
early_warning:
name: Early Warning Time
description: Time before event to send first notification
default: 30
selector:
number:
min: 5
max: 120
unit_of_measurement: minutes
medium_warning:
name: Medium Warning Time
description: Time before event to send medium urgency notification
default: 15
selector:
number:
min: 2
max: 60
unit_of_measurement: minutes
urgent_warning:
name: Urgent Warning Time
description: Time before event to send high urgency notification
default: 5
selector:
number:
min: 1
max: 30
unit_of_measurement: minutes
reminder_frequency:
name: Reminder Frequency After Missing
description: How often to send reminders if alerts are unacknowledged
default: 5
selector:
number:
min: 1
max: 30
unit_of_measurement: minutes
smart_lights:
name: Smart Lights (Optional)
description: Lights that can provide ambient notification
default: []
selector:
entity:
domain: light
multiple: true
notify_sound:
name: Notification Sound (iOS)
description: Sound for iOS notifications (leave empty for default)
default: ""
selector:
text:
verification_method:
name: Verification Method
description: How to verify that you've responded to notifications
default: acknowledgment
selector:
select:
options:
- label: Read receipt (implicit)
value: implicit
- label: Button press (acknowledgment)
value: acknowledgment
- label: QR code scan (proof of action)
value: proof
custom_message_templates:
name: Custom Message Templates (Optional)
description: >
Add variety to notifications by adding multiple message templates.
Enter one per line. Use {event} as placeholder for event name.
default: "Don't forget: {event} is coming up!"
selector:
text:
multiline: true
mode: queued
max_exceeded: silent
variables:
calendar_entity: !input calendar_entity
event_keyword: !input event_keyword
event_type: !input event_type
flexible_window: !input flexible_window
primary_device: !input primary_device
backup_devices: !input backup_devices
trusted_contact: !input trusted_contact
early_warning: !input early_warning
medium_warning: !input medium_warning
urgent_warning: !input urgent_warning
reminder_frequency: !input reminder_frequency
smart_lights: !input smart_lights
notify_sound: !input notify_sound
verification_method: !input verification_method
custom_message_templates: !input custom_message_templates
# Derived variables
primary_device_name: "{{ device_attr(primary_device, 'name') | slugify }}"
has_backup_devices: "{{ backup_devices | length > 0 }}"
has_trusted_contact: "{{ trusted_contact | length > 0 }}"
has_smart_lights: "{{ smart_lights | length > 0 }}"
message_templates: >
{% set messages = custom_message_templates.split('\n') | select('!=', '') | list %}
{% if messages | length == 0 %}
{% set messages = ["Don't forget: {event} is coming up!"] %}
{% endif %}
{{ messages }}
response_id: "make_sure_response_{{ now().strftime('%Y%m%d%H%M%S') }}"
trigger:
- platform: calendar
event: start
entity_id: !input calendar_entity
offset: "-{{ early_warning }} minutes"
condition:
- condition: template
value_template: >-
{% if event_keyword | length > 0 %}
{% set summary = trigger.calendar_event.summary | default('') %}
{% set description = trigger.calendar_event.description | default('') %}
{% if event_keyword in summary or event_keyword in description %}
true
{% else %}
false
{% endif %}
{% else %}
true
{% endif %}
action:
# 1. Store event details for later use
- variables:
event_summary: "{{ trigger.calendar_event.summary }}"
event_description: "{{ trigger.calendar_event.description | default('') }}"
event_start: "{{ trigger.calendar_event.start }}"
event_location: "{{ trigger.calendar_event.location | default('') }}"
notification_acknowledged: false
escalation_level: 1
random_message: >-
{% set msgs = message_templates %}
{% set selected_message = msgs | random %}
{{ selected_message.replace('{event}', event_summary) }}
# 2. Early warning - Passive notification
- service: notify.mobile_app_{{ primary_device_name }}
data:
title: "Coming up: {{ event_summary }}"
message: "{{ random_message }}"
data:
push:
interruption-level: "passive"
category: "make_sure"
sound: "{{ notify_sound if notify_sound else null }}"
actions:
- action: "{{ response_id }}_acknowledge"
title: "I'm on it"
destructive: false
# 3. Ambient notification via smart lights if available
- if:
condition: template
value_template: "{{ has_smart_lights }}"
then:
- service: light.turn_on
target:
entity_id: !input smart_lights
data:
color_name: "blue"
brightness_pct: 70
flash: short
- delay:
seconds: 2
- service: light.turn_on
target:
entity_id: !input smart_lights
data:
transition: 2
brightness_pct: 100
# 4. Wait for acknowledgment or proceed to next level
- wait_for_trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: "{{ response_id }}_acknowledge"
timeout:
minutes: "{{ early_warning - medium_warning }}"
continue_on_timeout: true
# 5. Check if notification was acknowledged
- if:
condition: template
value_template: "{{ wait.trigger }}"
then:
- variables:
notification_acknowledged: true
else:
# 6. Medium warning - More noticeable notification
- service: notify.mobile_app_{{ primary_device_name }}
data:
title: "⚠️ {{ event_summary }} is getting closer!"
message: "Starting in {{ medium_warning }} minutes"
data:
push:
interruption-level: "time-sensitive"
category: "make_sure"
sound: "{{ notify_sound if notify_sound else null }}"
actions:
- action: "{{ response_id }}_acknowledge"
title: "I'm on it"
destructive: false
# 7. If we have backup devices, also notify them
- if:
condition: template
value_template: "{{ has_backup_devices }}"
then:
- repeat:
for_each: "{{ backup_devices }}"
sequence:
- service: "notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify }}"
data:
title: "⚠️ {{ event_summary }} is approaching"
message: "Starting in {{ medium_warning }} minutes"
data:
push:
interruption-level: "active"
sound: "{{ notify_sound if notify_sound else null }}"
# 8. More dramatic light change if available
- if:
condition: template
value_template: "{{ has_smart_lights }}"
then:
- service: light.turn_on
target:
entity_id: !input smart_lights
data:
color_name: "yellow"
brightness_pct: 85
flash: short
- delay:
seconds: 1
- service: light.turn_on
target:
entity_id: !input smart_lights
data:
flash: short
# 9. Wait again for acknowledgment
- wait_for_trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: "{{ response_id }}_acknowledge"
timeout:
minutes: "{{ medium_warning - urgent_warning }}"
continue_on_timeout: true
# 10. Check if notification was acknowledged
- if:
condition: template
value_template: "{{ wait.trigger }}"
then:
- variables:
notification_acknowledged: true
else:
# 11. Urgent warning - Critical notification
- variables:
escalation_level: 3
- service: notify.mobile_app_{{ primary_device_name }}
data:
title: "🚨 URGENT: {{ event_summary }} STARTING SOON!"
message: "Only {{ urgent_warning }} minutes remaining!"
data:
push:
interruption-level: "critical"
category: "make_sure"
sound: "{{ notify_sound if notify_sound else null }}"
actions:
- action: "{{ response_id }}_acknowledge"
title: "I'm on it!"
destructive: false
- action: "{{ response_id }}_snooze"
title: "Snooze (2 min)"
destructive: false
# 12. Notify all backup devices
- if:
condition: template
value_template: "{{ has_backup_devices }}"
then:
- repeat:
for_each: "{{ backup_devices }}"
sequence:
- service: "notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify }}"
data:
title: "🚨 URGENT: {{ event_summary }} is about to start!"
message: "Only {{ urgent_warning }} minutes remaining!"
data:
push:
interruption-level: "critical"
sound: "{{ notify_sound if notify_sound else null }}"
# 13. Notify trusted contact if configured
- if:
condition: template
value_template: "{{ has_trusted_contact }}"
then:
- repeat:
for_each: "{{ trusted_contact }}"
sequence:
- service: "notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify }}"
data:
title: "πŸ”” Support needed for {{ event_summary }}"
message: "Your contact may need a reminder about this event."
data:
push:
interruption-level: "active"
sound: "{{ notify_sound if notify_sound else null }}"
actions:
- action: "{{ response_id }}_contact_nudge"
title: "Send them a nudge"
destructive: false
# 14. Red alert on smart lights if available
- if:
condition: template
value_template: "{{ has_smart_lights }}"
then:
- service: light.turn_on
target:
entity_id: !input smart_lights
data:
color_name: "red"
brightness_pct: 100
flash: long
- delay:
seconds: 2
- service: light.turn_on
target:
entity_id: !input smart_lights
data:
flash: long
# 15. Final wait before event
- wait_for_trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: "{{ response_id }}_acknowledge"
- platform: event
event_type: mobile_app_notification_action
event_data:
action: "{{ response_id }}_snooze"
- platform: event
event_type: mobile_app_notification_action
event_data:
action: "{{ response_id }}_contact_nudge"
timeout:
minutes: "{{ urgent_warning }}"
continue_on_timeout: true
# 16. Handle snooze if selected
- if:
condition: template
value_template: "{{ wait.trigger and wait.trigger.event.data.action == response_id ~ '_snooze' }}"
then:
- delay:
minutes: 2
- service: notify.mobile_app_{{ primary_device_name }}
data:
title: "⏰ {{ event_summary }} - Snoozed reminder"
message: "The event is starting very soon!"
data:
push:
interruption-level: "critical"
category: "make_sure"
sound: "{{ notify_sound if notify_sound else null }}"
# 17. Handle contact nudge if selected
- if:
condition: template
value_template: "{{ wait.trigger and wait.trigger.event.data.action == response_id ~ '_contact_nudge' }}"
then:
- service: notify.mobile_app_{{ primary_device_name }}
data:
title: "πŸ‘‹ Support nudge sent"
message: "A nudge was sent to remind you about {{ event_summary }}"
data:
push:
interruption-level: "critical"
category: "make_sure"
sound: "{{ notify_sound if notify_sound else null }}"
# 18. For flexible-window events, continue with post-event reminders
- if:
condition: template
value_template: "{{ event_type == 'flexible' and not notification_acknowledged }}"
then:
# Set up recurring reminders throughout the flexible window
- repeat:
count: "{{ (flexible_window / reminder_frequency) | int }}"
sequence:
- delay:
minutes: "{{ reminder_frequency }}"
- service: notify.mobile_app_{{ primary_device_name }}
data:
title: "⏳ {{ event_summary }} - Still pending"
message: "This flexible task still needs to be completed"
data:
push:
interruption-level: "active"
category: "make_sure"
sound: "{{ notify_sound if notify_sound else null }}"
actions:
- action: "{{ response_id }}_complete"
title: "Mark Complete"
destructive: false
- wait_for_trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: "{{ response_id }}_complete"
timeout:
minutes: "{{ reminder_frequency }}"
continue_on_timeout: true
- if:
condition: template
value_template: "{{ wait.trigger }}"
then:
- variables:
notification_acknowledged: true
- stop: Task completed
# Final notification if task wasn't completed
- if:
condition: template
value_template: "{{ not notification_acknowledged }}"
then:
- service: notify.mobile_app_{{ primary_device_name }}
data:
title: "❌ {{ event_summary }} - Not completed"
message: "The flexible window for this task has expired"
data:
push:
interruption-level: "critical"
sound: "{{ notify_sound if notify_sound else null }}"
# 19. Reset smart lights if applicable
- if:
condition: template
value_template: "{{ has_smart_lights }}"
then:
- service: light.turn_on
target:
entity_id: !input smart_lights
data:
transition: 2
color_name: "white"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment