Skip to content

Instantly share code, notes, and snippets.

@TristonFelix
Created September 22, 2025 22:39
Show Gist options
  • Save TristonFelix/c2c76d01cfbd5b5cf73d7ab71cfd51b1 to your computer and use it in GitHub Desktop.
Save TristonFelix/c2c76d01cfbd5b5cf73d7ab71cfd51b1 to your computer and use it in GitHub Desktop.
blueprint:
name: UniFi Doorbell → Android TV (snapshot toast + optional cast)
description: >
When your UniFi Protect doorbell rings, save a snapshot, show an on-screen
image notification on Android TV (via Notifications for Android TV), and optionally
cast the live camera stream to the TV for a set duration.
domain: automation
source_url: https://example.local/blueprints/unifi_doorbell_to_android_tv
input:
doorbell_ding_sensor:
name: Doorbell "ding" sensor (UniFi Protect)
description: The binary_sensor that turns ON when the doorbell is pressed.
selector:
entity:
domain: binary_sensor
camera_entity:
name: Doorbell camera
selector:
entity:
domain: camera
android_tv_notify_service:
name: Android TV notify service
description: The notify service created by the "Notifications for Android TV" integration (e.g., notify.android_tv_living_room).
default: notify.android_tv_living_room
selector:
text:
snapshot_filename:
name: Snapshot file path
description: Where to save the image on HA host (must be under /config/www to be served at /local).
default: /config/www/snapshots/doorbell/latest.jpg
selector:
text:
image_url:
name: Public URL to the snapshot
description: Full URL that the TV can fetch (e.g., https://YOUR_HA_URL/local/snapshots/doorbell/latest.jpg).
default: https://YOUR_HA_URL/local/snapshots/doorbell/latest.jpg
selector:
text:
notify_title:
name: Notify title
default: Ding dong
selector:
text:
notify_message:
name: Notify message
default: Someone is at the Front Door
selector:
text:
notify_duration:
name: On-screen duration (seconds)
default: 10
selector:
number:
min: 3
max: 60
mode: slider
unit_of_measurement: s
notify_position:
name: On-screen position
description: Position supported by Notifications for Android TV (e.g., top-right, top-left, bottom-right, bottom-left, center).
default: top-right
selector:
text:
enable_cast:
name: Also cast the live stream
description: If enabled, will cast the doorbell camera stream to your TV for the duration below.
default: false
selector:
boolean:
cast_media_player:
name: Target TV media_player (for casting)
description: Required if "Also cast the live stream" is enabled.
selector:
entity:
domain: media_player
default:
cast_duration:
name: Cast duration (seconds)
default: 30
selector:
number:
min: 5
max: 300
mode: slider
unit_of_measurement: s
enable_tts:
name: Also speak a TTS message on the TV
default: false
selector:
boolean:
tts_media_player:
name: TTS media_player
description: Usually the same TV; used when "Also speak a TTS message" is enabled.
selector:
entity:
domain: media_player
default:
tts_message:
name: TTS message
default: Someone is at the front door
selector:
text:
mode: single
max_exceeded: silent
trigger:
- platform: state
entity_id: !input doorbell_ding_sensor
to: "on"
action:
- alias: Make a fresh snapshot
service: camera.snapshot
target:
entity_id: !input camera_entity
data:
filename: !input snapshot_filename
- alias: Notify Android TV with snapshot
# Notifications for Android TV accepts extras in data: { image, duration, position }
service: !input android_tv_notify_service
data:
title: !input notify_title
message: !input notify_message
data:
image: !input image_url
duration: !input notify_duration
position: !input notify_position
- alias: Optional TTS
choose:
- conditions:
- condition: template
value_template: "{{ iif((inputs.enable_tts | default(false)), true, false) }}"
sequence:
- service: tts.google_translate_say
target:
entity_id: !input tts_media_player
data:
message: !input tts_message
- alias: Optional live cast
choose:
- conditions:
- condition: template
value_template: "{{ iif((inputs.enable_cast | default(false)), true, false) }}"
sequence:
- service: camera.play_stream
target:
entity_id: !input camera_entity
data:
media_player: !input cast_media_player
format: hls
- delay:
seconds: !input cast_duration
- service: media_player.media_stop
target:
entity_id: !input cast_media_player
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment