Refactor calendar event conditions to use 'm365_family_events' for improved accuracy in automation triggers
This commit is contained in:
@@ -1211,7 +1211,7 @@
|
||||
entity_id: calendar.m365_family_events
|
||||
state: 'on'
|
||||
- condition: template
|
||||
value_template: '{{ ''camp'' in (state_attr(''calendar.family_events'', ''summary'')
|
||||
value_template: '{{ ''camp'' in (state_attr(''calendar.m365_family_events'', ''summary'')
|
||||
| lower) }}'
|
||||
action:
|
||||
- service: media_player.play_media
|
||||
@@ -1273,16 +1273,14 @@
|
||||
"13:30:00": Time to read a book or listen to a story.
|
||||
"14:00:00": Let’s move! Try a Minecraft brain break!
|
||||
"14:30:00": Time to relax with mindfulness or yoga.
|
||||
"19:29:00": Turds.
|
||||
- service: notify.alexa_media
|
||||
data:
|
||||
target:
|
||||
# - media_player.living_room
|
||||
# - media_player.jordyn_s_room
|
||||
# - media_player.chloe_s_room
|
||||
# - media_player.declan_s_room
|
||||
# - media_player.kitchen
|
||||
- media_player.parents_room
|
||||
- media_player.living_room
|
||||
- media_player.jordyn_s_room
|
||||
- media_player.chloe_s_room
|
||||
- media_player.declan_s_room
|
||||
- media_player.kitchen
|
||||
message: "{{ messages[now().strftime('%H:%M:%S')] }}"
|
||||
data:
|
||||
type: announce
|
||||
@@ -1294,12 +1292,18 @@
|
||||
- platform: time
|
||||
at: "08:30:00"
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: calendar.m365_family_events
|
||||
state: 'on'
|
||||
- condition: template
|
||||
value_template: >
|
||||
{{ 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 }}
|
||||
- condition: state
|
||||
entity_id: calendar.m365_family_events
|
||||
state: 'on'
|
||||
- condition: template
|
||||
value_template: >
|
||||
{{ state_attr('calendar.m365_family_events', 'data')
|
||||
| selectattr('summary', 'defined')
|
||||
| map(attribute='summary')
|
||||
| map('lower')
|
||||
| select('search', 'camp')
|
||||
| reject('search', 'no camp')
|
||||
| list | count > 0 }}
|
||||
action:
|
||||
- service: media_player.play_media
|
||||
data:
|
||||
@@ -1310,12 +1314,11 @@
|
||||
- service: notify.alexa_media
|
||||
data:
|
||||
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.living_room
|
||||
- media_player.declan_s_room
|
||||
- media_player.jordyn_s_room
|
||||
- media_player.kitchen
|
||||
- media_player.tv_alexa
|
||||
message: >
|
||||
Time to prepare for day camp. Please do the following:
|
||||
Fill water bottles, Put on deodorant, Brush teeth, and Jordyn Brush your hair.
|
||||
@@ -1325,15 +1328,18 @@
|
||||
- platform: time
|
||||
at: "08:45:00"
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: calendar.m365_family_events
|
||||
state: 'on'
|
||||
- condition: template
|
||||
value_template: >
|
||||
{{ 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 }}
|
||||
- condition: state
|
||||
entity_id: calendar.m365_family_events
|
||||
state: 'on'
|
||||
- condition: template
|
||||
value_template: >
|
||||
{{ state_attr('calendar.m365_family_events', 'data')
|
||||
| selectattr('summary', 'defined')
|
||||
| map(attribute='summary')
|
||||
| map('lower')
|
||||
| select('search', 'camp')
|
||||
| reject('search', 'no camp')
|
||||
| list | count > 0 }}
|
||||
action:
|
||||
- service: media_player.play_media
|
||||
data:
|
||||
@@ -1360,7 +1366,7 @@
|
||||
state: 'on'
|
||||
- condition: template
|
||||
value_template: >
|
||||
{{ 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 }}
|
||||
{{ state_attr('calendar.m365_family_events', 'data') | selectattr('summary', 'defined') | map(attribute='summary') | map('lower') | select('search', 'camp') | select('search', 'no', invert=True) | list | count > 0 }}
|
||||
action:
|
||||
- service: media_player.play_media
|
||||
data:
|
||||
@@ -1382,7 +1388,7 @@
|
||||
- condition: template
|
||||
value_template: >
|
||||
{{ 'no camp' in (
|
||||
state_attr('calendar.family_events', 'data')
|
||||
state_attr('calendar.m365_family_events', 'data')
|
||||
| selectattr('summary', 'defined')
|
||||
| map(attribute='summary')
|
||||
| map('lower')
|
||||
|
||||
Reference in New Issue
Block a user