I’m trying to rework my ‘Welcome Home’ TTS announcements. Currently I have two automations for USER1
and USER2
that both look similar to the below.
- alias: Notification Audio - Welcome Home USER1
trigger:
- platform: state
entity_id: device_tracker.USER1
from: 'not_home'
to: 'home'
for: '00:02:00'
condition:
- condition: time
after: '07:30'
before: '19:00'
action:
- delay: '00:00:10'
- service: script.turn_on
entity_id: script.say
data:
variables:
master: 'media_player.chalkboard_room'
where: 'media_player.chalkboard_room, media_player.kitchen, media_player.loft'
volume: '.5'
what: 'Welcome home USER1.'
- alias: Notification Audio - Welcome Home USER2
trigger:
- platform: state
entity_id: device_tracker.USER2
from: 'not_home'
to: 'home'
for: '00:02:00'
condition:
- condition: time
after: '07:30'
before: '19:00'
action:
- delay: '00:00:10'
- service: script.turn_on
entity_id: script.say
data:
variables:
master: 'media_player.chalkboard_room'
where: 'media_player.chalkboard_room, media_player.kitchen, media_player.loft'
volume: '.5'
what: 'Welcome home USER2.'
What I want to do is add a condition to the USER1
automation that looks at USER2
's device tracker to see if it just arrived home too. Then if it did, don’t fire the single user automation but fire a different one.
I was thinking I could use a template trigger to look at the .last_changed
attribute of the state, but that doesn’t really tell me that they arrived home at the same time.
So really it needs to be:
- Automation that welcomes
USER1
home (assumptions:USER2
is away,USER2
was already home,USER2
didn’t just arrive home) - Automation that welcomes
USER2
home (assumptions:USER1
is away,USER1
was already home,USER1
didn’t just arrive home) - Automation that welcomes
USER1
andUSER2
home (assumptions:USER1
andUSER2
just arrived home together)