Hello all!
I am working on an automation where the user of the mobile app (on Android) shares (for instance) a youtube link to the HomeAssistant app. Home Assistant triggers an automation based on mobile_app.share
event. The automation should send back a notification only to the client which sent the share event (I have several clients), giving them a list of players where to play the URL being sent.
My problem is - how do I find out which mobile_app instance I need to send the notification to, based on the event data?
Here’s a sample event that I can see in Developer Tools → Events:
event_type: mobile_app.share
data:
caller: android-app://org.polymorphicshade.tubular
subject: Can Curiosity Heal Division? | Scott Shigeoka | TED
url: https://www.youtube.com/watch?v=nT1MYWOFgJo
device_id: a7cfbe1b0133ba3f
origin: REMOTE
time_fired: "2024-12-07T08:25:19.129804+00:00"
context:
id: 01JEG3J8GS4SQB9ZDG4SRREHRW
parent_id: null
user_id: 1f269cc5e671416fb656d4f9e3ad1b0c
I can extract the url, for instance with:
variables:
url: "{{ trigger.event.data.url }}"
How can I get from device_id, context id or user_id a reference to notify.mobile_app_my_phone_name
?
I have one device per user, so even if I have the user id mapped to the user, I could have some manual mapping.
Are there any guides on handling this? Thanks!