tag_scanned event provides output similar to following:
{
"event_type": "tag_scanned",
"data": {
"tag_id": "93182830-f2c9-4557-9ffa-94ebce875b19",
"device_id": "E6Axxxxxxxxxxxxxxxxxxx0D2"
},
"origin": "LOCAL",
"time_fired": "2021-11-07T08:05:51.119693+00:00",
"context": {
"id": "645a4fb060f5155b7ef658e0c3f8f97c",
"parent_id": null,
"user_id": "3df1eccaaa654858b72e6d942ecc39e0"
}
}
You test trigger for for either device_id to identify specific device that was used to scan NFC or user_id to identify user (though this would be user associated with the device, so result woul dbe the same…
Here is sample automation that can be triggered only by specific tag and specific device (so effectively associates this automation to specific user):
- alias: 'Toggle lights on NFC'
initial_state: true
trigger:
platform: event
event_type: tag_scanned
event_data:
tag_id: 93182830-f2c9-4557-9ffa-94ebce875b19
device_id: E6Axxxxxxxxxxxxxxxxxxx0D2
action:
service: light.toggle
entity_id: light.mirek_office