Skip to content

Instantly share code, notes, and snippets.

@bbbenji
Last active June 17, 2025 08:26
Show Gist options
  • Save bbbenji/ecfc6804a539c90f13f57292ca405c82 to your computer and use it in GitHub Desktop.
Save bbbenji/ecfc6804a539c90f13f57292ca405c82 to your computer and use it in GitHub Desktop.
Smart Intercom Automation
blueprint:
name: Intercom Notification
description: Notification of a ring from the intercom with support for mobile app and HTML5 push notifications
domain: automation
input:
doorbell_sensor:
name: Doorbell Detection
description: Select the doorbell sensor
selector:
entity:
filter:
- device_class: sound
domain: binary_sensor
door_switch:
name: Door-opening Button
description: Select the switch to open the door
selector:
entity:
filter:
domain:
- button
notification_type:
name: Notification Type
description: Choose the type of notification to send
selector:
select:
options:
- label: Mobile App Only
value: mobile_only
- label: HTML5 Push Only
value: html5_only
- label: Both Mobile App and HTML5 Push
value: both
default: mobile_only
notify_device:
name: Mobile Notification Device
description: Select the mobile device to receive the notification (required for mobile app notifications)
selector:
device:
filter:
integration: mobile_app
default: null
html5_notify_service:
name: HTML5 Notification Service
description: Select the HTML5 notification service (e.g., notify.html5_chrome_desktop, notify.html5_firefox_mobile)
selector:
entity:
filter:
domain: notify
default: null
mode: restart
triggers:
trigger: state
entity_id: !input doorbell_sensor
to: "on"
from: "off"
actions:
- variables:
notification_type: !input notification_type
notify_device: !input notify_device
html5_service: !input html5_notify_service
# Send Mobile App Notification
- if:
- condition: or
conditions:
- condition: template
value_template: "{{ notification_type == 'mobile_only' }}"
- condition: template
value_template: "{{ notification_type == 'both' }}"
then:
- if:
- condition: template
value_template: "{{ notify_device is not none }}"
then:
- domain: mobile_app
type: notify
device_id: !input notify_device
title: Intercom
message: Someone is at the entrance
data:
# persistent: true
ttl: 0
priority: high
importance: high
channel: intercom
tag: intercom
actions:
- action: intercom_open
title: Open door
- action: intercom_ignore
title: Ignore
else:
- action: system_log.write
data:
message: "Mobile app notification requested but no device selected"
level: warning
# Send HTML5 Push Notification
- if:
- condition: or
conditions:
- condition: template
value_template: "{{ notification_type == 'html5_only' }}"
- condition: template
value_template: "{{ notification_type == 'both' }}"
then:
- if:
- condition: template
value_template: "{{ html5_service is not none }}"
then:
- action: "{{ html5_service }}"
data:
title: Intercom
message: Someone is at the entrance
data:
tag: intercom
requireInteraction: true
actions:
- action: intercom_open
title: Open door
- action: intercom_ignore
title: Ignore
else:
- action: system_log.write
data:
message: "HTML5 notification requested but no service selected"
level: warning
# Wait for notification action from either mobile app or HTML5
- wait_for_trigger:
- platform: event
event_type: mobile_app_notification_action
id: mobile_intercom_open_id
event_data:
action: intercom_open
tag: intercom
- platform: event
event_type: html5_notification_action
id: html5_intercom_open_id
event_data:
action: intercom_open
tag: intercom
timeout: "00:00:30"
continue_on_timeout: false
# Clear mobile app notification if it was sent
- if:
- condition: and
conditions:
- condition: or
conditions:
- condition: template
value_template: "{{ notification_type == 'mobile_only' }}"
- condition: template
value_template: "{{ notification_type == 'both' }}"
- condition: template
value_template: "{{ notify_device is not none }}"
then:
- domain: mobile_app
type: notify
device_id: !input notify_device
message: clear_notification
data:
tag: intercom
# Clear HTML5 notification if it was sent
- if:
- condition: and
conditions:
- condition: or
conditions:
- condition: template
value_template: "{{ notification_type == 'html5_only' }}"
- condition: template
value_template: "{{ notification_type == 'both' }}"
- condition: template
value_template: "{{ html5_service is not none }}"
then:
- action: "{{ html5_service }}"
data:
message: clear_notification
data:
tag: intercom
# Press the door switch
- action: button.press
target:
entity_id: !input door_switch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment