Refactor daily Alexa announcements automation for improved clarity and efficiency in triggers, conditions, and actions

This commit is contained in:
Joshua King
2025-06-30 21:11:47 -04:00
parent 2bf523f09b
commit c9db0c6d0c

View File

@@ -1223,76 +1223,79 @@
- id: '1744503044809' - id: '1744503044809'
alias: Daily Alexa Announcements for Kids alias: Daily Alexa Announcements for Kids
description: Schedule of Alexa announcements for structured daily routine description: Schedule of Alexa announcements for structured daily routine
triggers: trigger:
- at: 09:00:00 - platform: time
trigger: time at: "09:00:00"
- at: '10:00:00' - platform: time
trigger: time at: "10:00:00"
- at: '10:15:00' - platform: time
trigger: time at: "10:15:00"
- at: '11:00:00' - platform: time
trigger: time at: "11:00:00"
- at: '12:00:00' - platform: time
trigger: time at: "12:00:00"
- at: '12:30:00' - platform: time
trigger: time at: "12:30:00"
- at: '13:00:00' - platform: time
trigger: time at: "13:00:00"
- at: '13:30:00' - platform: time
trigger: time at: "13:30:00"
- at: '14:00:00' - platform: time
trigger: time at: "14:00:00"
- at: '19:29:00' - platform: time
trigger: time at: "19:29:00"
conditions: condition:
- condition: state - condition: state
entity_id: calendar.m365_family_events entity_id: calendar.m365_family_events
state: 'on' state: 'on'
- condition: template - condition: template
value_template: '{{ ''no camp'' in (state_attr(''calendar.family_events'', ''summary'') value_template: >
| lower) }}' {{ 'no camp' in [
actions: item.summary.lower()
for item in (state_attr('calendar.family_events', 'data') or [])
if 'summary' in item
] }}
action:
- variables: - variables:
messages: messages:
08:00:00: Time for breakfast and a little TV! "08:00:00": Time for breakfast and a little TV!
09:00:00: Outside play time! If its bad weather, do your learning activities "09:00:00": Outside play time! If its bad weather, do your learning activities inside.
inside. "10:00:00": Snack time!
'10:00:00': Snack time! "10:15:00": Time for quiet play or outside fun.
'10:15:00': Time for quiet play or outside fun. "11:00:00": Creative time! Draw, color, or write something cool!
'11:00:00': Creative time! Draw, color, or write something cool! "12:00:00": Lunch time! Wash up and head to the table.
'12:00:00': Lunch time! Wash up and head to the table. "12:30:00": Happy Helper Time! Do your chores like a champ!
'12:30:00': Happy Helper Time! Do your chores like a champ! "13:00:00": TV break — relax and enjoy.
'13:00:00': TV break — relax and enjoy. "13:30:00": Time to read a book or listen to a story.
'13:30:00': Time to read a book or listen to a story. "14:00:00": Lets move! Try a Minecraft brain break!
'14:00:00': Lets move! Try a Minecraft brain break! "14:30:00": Time to relax with mindfulness or yoga.
'14:30:00': Time to relax with mindfulness or yoga. "19:29:00": Turds.
'19:29:00': Turds. - service: notify.alexa_media
- data: data:
target: target:
- media_player.living_room # - media_player.living_room
- media_player.jordyn_s_room # - media_player.declan_s_room
- media_player.chloe_s_room # - media_player.jordyn_s_room
- media_player.declan_s_room # - media_player.kitchen
- media_player.kitchen # - media_player.tv_alexa
message: '{{ messages[now().strftime(''%H:%M:%S'')] }}' - media_player.parents_room
message: "{{ messages[now().strftime('%H:%M:%S')] }}"
data: data:
type: announce type: announce
method: all method: all
action: notify.alexa_media
mode: single mode: single
- id: '1744503044813' - id: '1744503044813'
alias: Announce day camp preparation and pause TV alias: Announce day camp preparation and pause TV
trigger: trigger:
- platform: time - platform: time
at: 08:30:00 at: "08:30:00"
conditions: condition:
- condition: state - condition: state
entity_id: calendar.m365_family_events entity_id: calendar.m365_family_events
state: 'on' state: 'on'
- condition: template - condition: template
value_template: "{{ 'camp' in (state_attr('calendar.family_events', 'summary') value_template: >
| lower) and 'no' not in (state_attr('calendar.family_events', 'summary') {{ state_attr('calendar.family_events', 'data') | selectattr('summary', 'defined') | map(attribute='summary') | map('lower') | select('search', 'camp') | select('search', 'no', invert=True) | list | count > 0 }}
| lower) }}"
action: action:
- service: media_player.play_media - service: media_player.play_media
data: data:
@@ -1303,26 +1306,30 @@
- service: notify.alexa_media - service: notify.alexa_media
data: data:
target: target:
- media_player.living_room # - media_player.living_room
- media_player.declan_s_room # - media_player.declan_s_room
- media_player.jordyn_s_room # - media_player.jordyn_s_room
- media_player.kitchen # - media_player.kitchen
- media_player.tv_alexa # - media_player.tv_alexa
message: 'Time to prepare for day camp. Please do the following: Fill water - media_player.parents_room
bottles, Put on deodorant, Brush hair for Jordyn, Brush teeth.' message: >
Time to prepare for day camp. Please do the following:
Fill water bottles, Put on deodorant, Brush teeth, and Jordyn Brush your hair.
- id: '1744503044814' - id: '1744503044814'
alias: Announce time to leave for day camp and turn off TV alias: Announce time to leave for day camp and turn off TV
trigger: trigger:
- platform: time - platform: time
at: 08:45:00 at: "08:45:00"
conditions: condition:
- condition: state - condition: state
entity_id: calendar.m365_family_events entity_id: calendar.m365_family_events
state: 'on' state: 'on'
- condition: template - condition: template
value_template: "{{ 'camp' in (state_attr('calendar.family_events', 'summary') value_template: >
| lower) and 'no' not in (state_attr('calendar.family_events', 'summary') {{ state_attr('calendar.family_events', 'data')
| lower) }}" | selectattr('summary', 'defined') | map(attribute='summary')
| map('lower') | select('search', 'camp')
| select('search', 'no', invert=True) | list | count > 0 }}
action: action:
- service: media_player.play_media - service: media_player.play_media
data: data:
@@ -1333,29 +1340,23 @@
- service: notify.alexa_media - service: notify.alexa_media
data: data:
target: target:
# - media_player.living_room
# - media_player.declan_s_room
# - media_player.jordyn_s_room
# - media_player.kitchen
# - media_player.tv_alexa
- media_player.parents_room - media_player.parents_room
message: 'It is time to leave for day camp. Please do the following: Put on message: >
shoes, Get lunch, Get water bottle, Get bag if needed.' It is time to leave for day camp. Please do the following:
Put on shoes, Get lunch, Get water bottle, Get bag if needed.
- id: '1744503044145' - id: '1744503044145'
alias: Reet Alexa Announcement Volume - Camp Days alias: Reset Alexa Announcement Volume - Camp Days
description: Set Alexa announcement volume for structured daily routine description: Set Alexa announcement volume for structured daily routine
mode: single
trigger: trigger:
- platform: time - platform: time
at: 09:15:00 at: "09:15:00"
conditions: condition:
- condition: state - condition: state
entity_id: calendar.m365_family_events entity_id: calendar.m365_family_events
state: 'on' state: 'on'
- condition: template - condition: template
value_template: "{{ 'camp' in (state_attr('calendar.family_events', 'summary') value_template: >
| lower) and 'no' not in (state_attr('calendar.family_events', 'summary') {{ state_attr('calendar.family_events', 'data') | selectattr('summary', 'defined') | map(attribute='summary') | map('lower') | select('search', 'camp') | select('search', 'no', invert=True) | list | count > 0 }}
| lower) }}"
action: action:
- service: media_player.play_media - service: media_player.play_media
data: data:
@@ -1363,24 +1364,29 @@
media_content_type: routine media_content_type: routine
target: target:
entity_id: media_player.basement_show entity_id: media_player.basement_show
mode: single
- id: '1744503044146' - id: '1744503044146'
alias: Reset Alexa Announcement Volume - No Camp Days alias: Reset Alexa Announcement Volume - No Camp Days
description: Set Alexa announcement volume for structured daily routine description: Set Alexa announcement volume for structured daily routine
triggers: trigger:
- at: '19:17:00' - platform: time
trigger: time at: "19:17:00"
conditions: condition:
- condition: state - condition: state
entity_id: calendar.m365_family_events entity_id: calendar.m365_family_events
state: 'on' state: 'on'
- condition: template - condition: template
value_template: '{{ ''no camp'' in (state_attr(''calendar.family_events'', ''summary'') value_template: >
| lower) }}' {{ 'no camp' in [
actions: item.summary.lower()
- data: for item in (state_attr('calendar.family_events', 'data') or [])
if 'summary' in item
] }}
action:
- service: media_player.play_media
data:
media_content_id: Reset Alexa Volume media_content_id: Reset Alexa Volume
media_content_type: routine media_content_type: routine
target: target:
entity_id: media_player.basement_show entity_id: media_player.basement_show
action: media_player.play_media
mode: single mode: single