Hi,
I have an automation which triggers when a group of people changes from ‘home’ to ‘not home’. Essentially works as a last to leave trigger. However I want to the the name of the person whom is last to leave.
Below is the automation’s YAML:
alias: Auto Alarm
description: Alarm not set reminder
trigger:
- platform: state
entity_id:
- group.family
from: home
to: not_home
for:
hours: 0
minutes: 10
seconds: 0
condition:
- condition: and
conditions:
- condition: state
entity_id: alarm_control_panel.alarm
state: disarmed
- condition: state
entity_id: input_boolean.guest_mode
state: 'off'
action:
- device_id: ********
domain: mobile_app
type: notify
message: No-one is home and the alarm isn't set!
title: Alarm reminder
mode: single
I want to update the message so that it can read - Person 1 was the last to leave and the alarm hasn’t been set, but I can’t seem to get the name of the person from the group which caused the state to change. I believe this information is available as the logbook entry for the group reports who caused the state to change.
The ultimate plan is to use the name to send a first reminder to the last person to leave then a message to the rest of the group.
I have tried {{ trigger.to_state.attributes.friendly_name }}
but this gives me the name of the group not the person who triggered the group update.
Hope this makes sense, and any help and advice will be greatly appreciated.
Thanks in advanced.
James