Automation for multiple devices (persons)

Hi I would like to create a automation that changes alexa guard to arm_away when me AND my friend leave the home.

so if we both leave the house wifi it starts guarding. this is what i have so far:

##TRIGGER


platform: state
for:
  hours: 0
  minutes: 0
  seconds: 0
  milliseconds: 0
entity_id: sensor.username_iphone_ssid
from: WIFI SSID


##CONDITION


condition: state
entity_id: sensor.username_iphone_ssid
state: from: WIFI SSID



##ACTION:


service: alarm_control_panel.alarm_arm_away
target:
  entity_id: alarm_control_panel.alexa_guard_5af39
data:
  code: 'type: call_service'

Best way would be to make a group in which you put the persons.

Either in configuration or a separate groups.yaml

  name: Family
  entities:
    - person.1
    - person.2
    - person.3
    - person.4

That way you can use whatever way to track someone attached to a person and you wont have to change the automation.
And in automation use the not_home.

Something like:

alias: CV Standby - No one in Home
description: ''
trigger:
  - platform: state
    entity_id: group.family
    to: not_home
    for:
      hours: 0
      minutes: 30
      seconds: 0
      milliseconds: 0
    id: nothome30min
1 Like