UPD 08/12/2024: This should be fixed when my pull request #2910 reached the App Store - roughly around the last week of the August
I’m playing with an automation that is supposed to be triggered when an authorized HA user scans a NFC tag. Then the automation is supposed to send an actionable notification to the device that was used to scan the tag.
I already have an automation that does a similar thing when an event is triggered from the Apple Watch companion app.
notify.mobile_app_{{ trigger.event.data.sourceDeviceID }}
It works perfectly, since the event contains a sourceDeviceID
(which in fact contains an iPhone name) that can be used to send back a notification to a specific mobile device. Example of a such event below:
event:
event_type: ios.action_fired
data:
actionID: actuate
actionName: actuate
sourceDeviceID: n6ham
sourceDeviceName: N6HAM
sourceDevicePermanentID: ...
triggerSource: watch
origin: REMOTE
time_fired: '2024-08-08T19:03:44.183244+00:00'
context:
id: ...
parent_id: null
user_id: <User_ID>
I just wanted to add another trigger (Tag scanned) into the same automation, but it doesn’t work because there is no data related to the mobile device that scanned the tag. For example:
event:
event_type: tag_scanned
data:
tag_id: ...
name: Garage Keypad
device_id: 1f53d5bda8384j06037a904e801febac373
origin: LOCAL
time_fired: '2024-08-08T18:52:55.437050+00:00'
context:
id: ...
parent_id: null
user_id: <User_ID>
There’s off course a user_id
that can give an idea who scanned the tag, but I don’t want to maintain a mapping of user id to mobile device
or device id to device name
anywhere on HA side. Ideally there should be a sourceDeviceID=n6ham
in the event too.
Does anyone have workaround in mind, or this has to be a new feature request?
Alternatively, is there a way to send a notification to a mobile app using an actual device ID instead of device name, like
# notify.mobile_app_n6ham
notify.mobile_app_1f53d5bda8384j06037a904e801febac373