I use add-on room-assistant to track locations of our mobile phones. This works fine, so In HA I can see where each phone is located (living, kitchen, bedroom etc).
In HA I created an automation to send me a notification every time my tracked device is changing its position. In this automation I use the action “notify.mobile_app_oneplus9pro” to actually send this notification to my phone.
I now have for example below notification, which works but is rather a dump notification:
service: notify.mobile_app_oneplus9pro
data:
message: BT tracking - living
I want to make this notification smarter by adding the actual location to it.
I now struggle how to get this added to the automation.
I was thinking of this:
service: notify.mobile_app_oneplus9pro
data:
data: {}
message: >-
service: notify.mobile_app_oneplus9pro
data:
message: >-
Your OnePlus is detected at:
{% if is_state('sensor.oneplus_9_pro_room_presence', 'firstfloor') %} firstfloor
{% elif is_state('sensor.oneplus_9_pro_room_presence','living') %} living
{% elif is_state('sensor.oneplus_9_pro_room_presence', 'bedroom') %} bedroom
{% elif is_state('sensor.oneplus_9_pro_room_presence', 'kitchen') %}kitchen
{% elif is_state('sensor.oneplus_9_pro_room_presence','HomeServer') %} HomeServer
{% elif is_state('sensor.oneplus_9_pro_room_presence', 'not_home') %} not_home
{%elif is_state('sensor.oneplus_9_pro_room_presence', 'Unavailable') %} Unavailable
{%endif %}
Every time I try to save the automation, a grey bar moves in my screen indicating that I have an error at “data”. So I can’t save the automation. What am I doing wrong here?
Thanks!