Trigger variables

Automation Trigger Variable for State triggers represent the State Object of the triggering entity. The name property refers to the entity i.e. person.oscar it doesn’t refer to the state… that’s what the state property does.

Most of the time your people are going to be either leaving or entering an undefined zone, so I would set this up a bit differently… Also, you may want to use queued or parallel mode in case they happen to be changing zones at the same time.

alias: Kids location notify
description: ""
trigger:
  - platform: state
    entity_id:
      - person.oscar
      - person.christian_bendtsen
condition:
  - condition: template
    value_template: "{{ trigger.from_state.state != trigger.to_state.state  }}"
    alias: Not the same state
action:
  - choose:
    - conditions:
      - condition: template
        value_template: "{{ trigger.from_state.state == 'not_home'  }}"
        alias: Leaving Undefined zone
      sequence:
        - service: notify.mobile_app_michael_mobile
          data:
            title: Kids status
            message: >
              {{ trigger.to_state.name }} arrived at {{ trigger.to_state.state }}
    - conditions:
      - condition: template
        value_template: "{{ trigger.to_state.state == 'not_home'  }}"
        alias: Entering Undefined zone
      sequence:
        - service: notify.mobile_app_michael_mobile
          data:
            title: Kids status
            message: >
              {{ trigger.to_state.name }} left {{ trigger.from_state.state }}
    default:
      - service: notify.mobile_app_michael_mobile
        data:
          title: Kids status
          message: >
            {{ trigger.to_state.name }} from {{ trigger.from_state.state }} to {{
        trigger.to_state.state }}
mode: single