Skip to content

Instantly share code, notes, and snippets.

@jasontucker
Created November 9, 2024 19:50
Show Gist options
  • Save jasontucker/55c85f15975542f469fa7cae9012c93d to your computer and use it in GitHub Desktop.
Save jasontucker/55c85f15975542f469fa7cae9012c93d to your computer and use it in GitHub Desktop.
Calendar based Dynamic Doorbell Message for Ubiquiti Unifi Doorbell using Home Assistant
# automations.yaml
alias: "Update Doorbell with Day-Specific Message at 4:10am"
trigger:
- platform: time
at: "00:04:10" # Run daily at midnight
action:
- choose:
- conditions:
- condition: or
conditions:
- condition: state
entity_id: calendar.holidays # First holiday calendar entity
state: "on"
- condition: state
entity_id: calendar.home_calendar # Second calendar entity
state: "on"
sequence:
- service: text.set_value
target:
entity_id: text.capulet_doorbell_doorbell
data:
value: >
{% set event1 = state_attr('calendar.holidays', 'message') %}
{% set event2 = state_attr('calendar.home_calendar', 'message') %}
{% if event1 %}
Happy {{ event1 }}!
{% elif event2 %}
Happy {{ event2 }}!
{% else %}
WELCOME!
{% endif %}
- conditions:
- condition: state
entity_id: sensor.day_of_week
state: "Monday"
sequence:
- service: text.set_value
target:
entity_id: text.capulet_doorbell_doorbell
data:
value: "It's Monday! Welcome!"
- conditions:
- condition: state
entity_id: sensor.day_of_week
state: "Tuesday"
sequence:
- service: text.set_value
target:
entity_id: text.capulet_doorbell_doorbell
data:
value: "Happy Tuesday!"
- conditions:
- condition: state
entity_id: sensor.day_of_week
state: "Wednesday"
sequence:
- service: text.set_value
target:
entity_id: text.capulet_doorbell_doorbell
data:
value: "Wednesday Vibes!"
- conditions:
- condition: state
entity_id: sensor.day_of_week
state: "Thursday"
sequence:
- service: text.set_value
target:
entity_id: text.capulet_doorbell_doorbell
data:
value: "Almost Friday!"
- conditions:
- condition: state
entity_id: sensor.day_of_week
state: "Friday"
sequence:
- service: text.set_value
target:
entity_id: text.capulet_doorbell_doorbell
data:
value: "TGIF!"
- conditions:
- condition: state
entity_id: sensor.day_of_week
state: "Saturday"
sequence:
- service: text.set_value
target:
entity_id: text.capulet_doorbell_doorbell
data:
value: "Enjoy your Saturday!"
- conditions:
- condition: state
entity_id: sensor.day_of_week
state: "Sunday"
sequence:
- service: text.set_value
target:
entity_id: text.capulet_doorbell_doorbell
data:
value: "Relax, it's Sunday!"
default:
- service: text.set_value
target:
entity_id: text.capulet_doorbell_doorbell
data:
value: "WELCOME!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment