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