Ok, so I am being my usual dense self.
Trying to streamline my automations to use one to get the job done instead of multiple as I have been doing.
So I need to use variables in automations to give me the information I need in notification messages but I am missing something.
I even thought I could make it simpler by using a group e.g. group.people_owners state as a trigger (whose state shows home/not_home depending states of two mobile devices instead of what I have below) but then it gives me the name of the group and not the entity inside the group that allowed the trigger to be matched.
According to the help articles, I could also use {{ trigger.trigger_id }} to get the details of the item that cause the state change. So since I am doff, I thought I gave up on using the group as trigger and rather added each item directly inside trigger and then assign a friendly trigger id which I thought I could then reference in the notification. But it does not give me the trigger id in message. What am I doing wrong?
Example below:
YAML:
alias: ' CHECK AND ARM HOME WHEN OWNERS LEAVE '
description: >-
Check to see if house needs to be be armed when Ted or Beard leaves .
Using GPS from HA app on phones
trigger:
- platform: zone
entity_id: person.ted
zone: zone.home
event: leave
id: Ted
- platform: zone
entity_id: person.beard
zone: zone.home
event: leave
id: Beard
condition:
- condition: and
conditions:
- condition: state
entity_id: alarm_control_panel.outside
state: disarmed
- condition: state
entity_id: group.people_staff
state: not_home
- condition: state
entity_id: group.people_owners
state: not_home
action:
- service: notify.mobiledevicesonly
data:
title: HOME
message: >-
{{ trigger.trigger_id }} left home and no-one else at home. Arming house.
House
- service: switch.turn_on
target:
entity_id:
- switch.study_pir_bypass
- data: {}
service: alarm_control_panel.alarm_arm_away
target:
entity_id:
- alarm_control_panel.outside
- delay:
hours: 0
minutes: 0
seconds: 10
milliseconds: 0
- data: {}
service: alarm_control_panel.alarm_arm_away
target:
entity_id: alarm_control_panel.inside
mode: single