#NFC Tag MultiSelect in blueprint

1 messages · Page 1 of 1 (latest)

brazen cairn
#

Hey, can't for the life of me how to get a blueprint to work allowing a selector to select a list of NFC tags to trigger on. What am I doing wrong? I added a selector and it shows the list of tags in the blueprint but never fires on them. I've tried like 20 different ways and can't seem to get it to work. I want a blueprint to only fire if a specific user scans it.


blueprint:
  name: User Specific NFC Tag Action
  description: Run action when selected users scanned an NFC tag
  domain: automation
  author: joshs85
  input:
    tags:
      name: Tags
      selector:
        target:
          entity:
            - domain:
                - tag
    users:
      name: Users
      selector:
        target:
          entity:
            - domain:
                - person
    action:
      name: Action
      selector:
        action: {}
variables:
  tags: !input tags
  users: !input users
  user_id: "{{ trigger.context.user_id }}"
  tag_id: "{{ trigger.event.data.tag_id }}"
  tag_ids: "{{ expand(tags.entity_id) | map(attribute='attributes.tag_id') | list }}"
  user_name: "{% set p = states.person | selectattr('attributes.user_id', 'eq', user_id) | list %}{{ p[0].attributes.friendly_name if p | count == 1 else 'unknown' }}"
triggers:
  - trigger: tag
    tag_id: >
      {% set tag_ids = expand(tags.entity_id) | map(attribute='attributes.tag_id') | list %}
      {{ tag_id in tag_ids }}
condition:
  condition: template
  value_template: >
    {% set user_ids = expand(users.entity_id) | map(attribute='attributes.user_id') | list %}
    {{ user_id in user_ids }}
action: !input action
mode: parallel
max: 10
white frigate
#

I don't see anything in the documentation that suggests that tag_id can be templated.

#

Can you use a state trigger with your !input tags entities instead of a tag trigger?

brazen cairn
#

how would I do that?

white frigate
#

Hm. For tags I would maybe replace the target selector with an entity (multiple: true) selector.
Then your trigger could be:

 - trigger: state
   entity_id: !input tags
   not_from: unavailable
   not_to: unavailable
#

that will trigger when one of the selected tags is scanned

brazen cairn
#

doesn't work. its an event.. example event data..
event_type: tag_scanned
data:
tag_id: 9589d804-5197-496c-8351-ae8685acb414
name: Master Bedroom Door
device_id: afe2abac0335bbee24de8406ddb7d378
origin: LOCAL
time_fired: "2025-10-09T01:52:12.809081+00:00"
context:
id: 01K73APD09YY1GS2TF37FSWFJ3
parent_id: null
user_id: 67bc664300774968836db05d5016082a

white frigate
#

there are multiple ways. A tag creates a tag entity, whose state changes when scanned.

brazen cairn
#

Isn't that what the selector is?

  input:
    tags:
      name: Tags
      selector:
        target:
          entity:
            - domain:
                - tag
white frigate
brazen cairn
#
      selector:
        entity:
          entity:
            - domain:
                - tag
#

?