With the latest syntax (introduced in 0.19), I manage to shrink down my automation to alert me when someone is back or away to this…
- alias: 'Occupants State Change Alert'
trigger:
platform: state
entity_id: device_tracker.ben, device_tracker.leia, device_tracker.luke, device_tracker.han, device_tracker.chewy
action:
service: notify.notify
data_template:
message: >
{{ trigger.entity_id|replace('device_tracker.', '')|capitalize }} is {% if trigger.to_state.state == 'home' %}back{% else %}away{% endif %}.
title: ""