I am really hoping someone can help me with this as this seems to be pretty common. I am trying to setup a notification with presence. I have setup the presence through my asus router.
I have read several threads and still can’t seem to figure this out…can you guys please help me? Thanks in advance
- id: '1576450548715'
alias: Presence Notification
description: ''
trigger:
- entity_id: device_tracker.mo_huawei_phone
platform: state
- entity_id: device_tracker.tarin_huawei_phone
platform: state
condition: []
action:
- data:
message: |
{% if trigger.entity_id == "device_tracker.mo_huawei_phone" %}
{% set person = "Mo" %}
{% elif trigger.entity_id == "device_tracker.tarin_huawei_phone" %}
{% set person = "Tarin" %}
{% endif %}
{% if trigger.to_state.state == 'home' %}
{{ person }} is home
{% else %}
{{ person }} has left home
{% endif %}
title: 'Home info {{ states.sensor.time.state }}'
service: notify.notify
I know you’ve found a solution, but you might be able to simplify even further. Instead of doing the if checking to figure out what name to use, I look up the friendly name of the trigger.entity_id (which is a person.some_person, instead of a device_tracker.some_device) like this: