Presence detection notification

I am trying to send notifications when certain People in my HA arrive/leave the home.

I have googled online and have found similar automation but they are based on individual devices instead of the Person they are associated to. I have create the following code:

alias: Family Presence Notification
description: ''
trigger:
  - entity_id: person.jane
    platform: state
  - entity_id: person.joe
    platform: state
action:
  - data_template:
      title: Presence Detection
      message: >-
        {{ trigger.to_state.entity_id }} is now {{ trigger.to_state.state }}
    service: notify.notify
mode: single

However I get the following error when I “Run automation”

Error: Error rendering data template: UndefinedError: ‘dict object’ has no attribute ‘to_state’

When you run it manually, there is no trigger details. Try to manually change the state of one of the person entities in developer tools.

1 Like