TONIGHT, I CREATED AN AUTOMATION FOR HOME ASSISTANT THAT LOOKS IN MINE AND MY PARTNERS CALENDAR FOR WORK TOMORROW EVERYDAY AT 21:20.
IF EITHER OF US HAS WORK TOMORROW THEN IT WILL TURN ON 2 X VIRTUAL SWITCHES.
alias: Work Tomorrow Me?
description: ""
triggers:
- at: "21:30:00"
trigger: time
conditions:
- condition: time
weekday:
- mon
- tue
- wed
- thu
- sun
after: "21:00:00"
before: "22:00:00"
actions:
- alias: Get calendar events for tomorrow
data:
duration:
hours: 13
minutes: 0
seconds: 0
target:
entity_id:
- calendar.me
response_variable: agenda
action: calendar.get_events
- variables:
worktomorrowme: >
{{ agenda['calendar.me'].events | selectattr('summary', 'search',
'Work', true) | list | count > 0 }}
- target:
entity_id: input_boolean.worktomorrowme
action: input_boolean.turn_{{ 'on' if worktomorrowme else 'off' }}
mode: single
AT 21:55 A 2ND AUTOMATION LOOKS TO SEE IT EITHER OF THE SWITCHES ARE ON AND IF WE’RE HOMER AND THE TELLY IS ON THEN IT TELLS US TO GO TO BEDFORDSHIRE
alias: Work Tomorrow = TV Off
description: ""
triggers:
- at: "21:50:00"
trigger: time
conditions:
- condition: or
conditions:
- condition: state
entity_id: input_boolean.worktomorrowme
state: "on"
- condition: state
entity_id: input_boolean.worktomorrowyou
state: "on"
actions:
- alias: If Disarmed
if:
- condition: and
conditions:
- condition: state
entity_id: input_boolean.burglar_alarm_disarmed
state: "on"
- condition: or
conditions:
- condition: zone
entity_id: person.me
zone: zone.home
- condition: zone
entity_id: person.you
zone: zone.home
then:
- alias: If TV On
if:
- condition: device
type: is_on
device_id: 4b66ca6e328086a03d167ab7ca0ccb54
entity_id: 02da56a8f6de2ee336bf4660aa22f576
domain: remote
then:
- action: media_player.play_media
metadata: {}
data:
media_content_id: amzn_sfx_doorbell_01
media_content_type: sound
target:
entity_id: media_player.echo_show_15
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
- alias: Echo Show Announce "Now boarding at gate 1 for Bedfordshire"
data:
message: Now boarding at gate 1 for Bedfordshire
target: media_player.echo_show_15
data:
type: tts
action: notify.alexa_media
- delay:
hours: 0
minutes: 9
seconds: 54
milliseconds: 0
- alias: If TV On
if:
- condition: device
type: is_on
device_id: 4b66ca6e328086a03d167ab7ca0ccb54
entity_id: 02da56a8f6de2ee336bf4660aa22f576
domain: remote
then:
- action: media_player.play_media
metadata: {}
data:
media_content_id: amzn_sfx_doorbell_01
media_content_type: sound
target:
entity_id: media_player.echo_show_15
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
- alias: >-
Echo Show Announce "Would passengers travelling to Bedfordshire,
please go to gate 1 now"
data:
target: media_player.echo_show_15
data:
type: tts
message: >-
Would passengers travelling to Bedfordshire, please go to gate 1
now
action: notify.alexa_media
- delay:
hours: 0
minutes: 9
seconds: 54
milliseconds: 0
- alias: If TV On
if:
- condition: device
type: is_on
device_id: 4b66ca6e328086a03d167ab7ca0ccb54
entity_id: 02da56a8f6de2ee336bf4660aa22f576
domain: remote
then:
- action: media_player.play_media
metadata: {}
data:
media_content_id: amzn_sfx_doorbell_01
media_content_type: sound
target:
entity_id: media_player.echo_show_15
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
- alias: >-
Echo Show Announce "Final call, for passengers travelling to
Bedfordshire"
data:
message: Final call, for passengers travelling to Bedfordshire
target: media_player.echo_show_15
data:
type: tts
action: notify.alexa_media
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
- action: media_player.media_stop
metadata: {}
data: {}
target:
entity_id: media_player.shield_2
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- action: remote.send_command
metadata: {}
data:
num_repeats: 1
delay_secs: 0.4
hold_secs: 0
command: BACK
target:
entity_id: remote.shield_tv_pro
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- type: turn_off
device_id: 4b66ca6e328086a03d167ab7ca0ccb54
entity_id: 02da56a8f6de2ee336bf4660aa22f576
domain: remote
- action: input_boolean.turn_off
metadata: {}
data: {}
target:
entity_id: input_boolean.worktomorrowme
- action: input_boolean.turn_off
metadata: {}
data: {}
target:
entity_id: input_boolean.worktomorrowyou
mode: single