Hello,
I’m new to blueprints and I’m writing one that should execute some actions when a tag is scanned in my house. Since I have multiple tags, I’d like the tag to also be part of the blueprint input.
I’m trying to avoid manually typing the tag_id, rather providing a tag selector in the UI. Therefore, my input portion is:
blueprint:
input:
tag:
name: "Target tag"
selector:
entity:
filter:
domain: tag
This provides the list of tags in the UI, and if I select one, the value passed to the automation is the “friendly name”, e.g. tag.over_coffee_machine
. I’m having a hard time writing the trigger portion of this blueprint.
I’ve tried a couple of variations, such as directly passing this:
trigger_variables:
tag: !input tag
trigger:
- platform: event
event_type: tag_scanned
event_data:
tag_id: "{{ tag }}"
Also tried getting the tag_id from the states attributes:
trigger_variables:
tag: !input tag
trigger:
- platform: event
event_type: tag_scanned
event_data:
tag_id: "{{ state_attr(tag, 'tag_id') }}"
And even tried this approach:
trigger_variables:
_tag: !input tag
trigger_tag: "{{ state_attr(_tag, 'tag_id') }}"
trigger:
- platform: event
event_type: tag_scanned
event_data:
tag_id: "{{ trigger_tag }}"
None of these are triggering the automation when I scan the tag.
I don’t know what else to try. Any suggestions?
Thank you!