Tag
The Tag trigger fires when a tag is scanned. Use it to start an automation from an NFC tag, a tag reader, or another integration that fires a tag scan in Home Assistant.
Using this trigger from the user interface
If you prefer building automations visually, Home Assistant walks you through this trigger step by step. You pick what to watch, tweak a few options, and save. No YAML knowledge required.
To create an automation from a tag:
- Go to Settings > Tags.
- Open the actions menu for the tag you want to use.
- Select Create automation.
To use this trigger in the automation editor:
- Go to Settings > Automations & scenes.
- Open an existing automation, or select Create automation > Create new automation.
- In the When section, select Add trigger.
- Select the type of trigger to add.
- Select Tag.
- In Tag, select the tag that should start the automation.
- Select Save.
Options in the UI
Using this trigger in YAML
If you work directly in YAML, or you want to know exactly what Home Assistant does under the hood, this section has the technical reference. It lists the field names you use in YAML, their types, and which ones are required.
In YAML, use trigger: tag. A basic example looks like this:
trigger: tag
tag_id: "A7-6B-90-5F"
This runs when the tag with the ID A7-6B-90-5F is scanned.
To only trigger when the tag is scanned by a specific device or scanner, add device_id.
trigger: tag
tag_id: "A7-6B-90-5F"
device_id: 0e19cd3cf2b311ea88f469a7512c307d
You can also provide multiple tag IDs or device IDs.
trigger: tag
tag_id:
- "A7-6B-90-5F"
- "04-B1-C6-62-2F-64-80"
device_id:
- 0e19cd3cf2b311ea88f469a7512c307d
- 1234567890abcdef1234567890abcdef
Options in YAML
The ID of the tag to watch. You can use one tag ID or a list of tag IDs.
Good to know
- This trigger listens for
tag_scannedevents. - In YAML,
device_idlimits the trigger to scans from specific devices or scanners. - The visual editor lets you pick the tag. To limit the trigger by
device_id, edit the automation in YAML.
Try it yourself
Ready to test this? Go to Settings > Automations & scenes, create a new automation, and add this trigger. Save the automation, then change the state of the targeted entity to watch the trigger fire on your actual entitiesAn entity represents a sensor, actor, or function in Home Assistant. Entities are used to monitor physical properties or to control other entities. An entity is usually part of a device or a service. [Learn more].
For this trigger, scan the tag you selected to test the automation. To inspect tag scan data, open Settings > Tools > Events, select Listen to events, and subscribe to tag_scanned.
More examples
Real scenarios where this trigger fires in automations and scripts. Copy any example and adapt it to your setup.
You don’t need to edit YAML to use these examples. Copy a YAML snippet from this page, open the automation editor in Home Assistant, and press Ctrl+V (or Cmd+V on Mac). Home Assistant automatically converts the pasted YAML into the visual editor format, whether it’s a full automation, a single trigger, a condition, or an action.
Automation: turn on a light when a tag is scanned
Place a tag near an entrance or room and scan it to turn on a light.
-
Trigger: Tag
- Tag: Entrance tag
-
Action: Turn on light
- Target: Entry light
YAML example for turning on a light when a tag is scanned
alias: "Turn on the entry light from a tag"
triggers:
- trigger: tag
tag_id: "A7-6B-90-5F"
actions:
- action: light.turn_on
target:
entity_id: light.entry
Automation: run an action only when a specific scanner reads the tag
If several devices can scan the same tag, use device_id in YAML to run the automation only when a specific scanner reads it.
-
Trigger: Tag
- Tag: Music tag
- device_id: 0e19cd3cf2b311ea88f469a7512c307d (add it in YAML)
-
Action: Turn on switch
- Target: Music player power
YAML example for running an action from a specific tag scanner
alias: "Turn on music from the living room tag reader"
triggers:
- trigger: tag
tag_id: "A7-6B-90-5F"
device_id: 0e19cd3cf2b311ea88f469a7512c307d
actions:
- action: switch.turn_on
target:
entity_id: switch.music_player_power
Still stuck?
The Home Assistant community is quick to help: join Discord for real-time chat, post on the community forum with the trigger you’re using and what you expected to happen, or share on our subreddit /r/homeassistant.
AI assistants like ChatGPT or Claude can also explain triggers or suggest the right one when you describe what you want in plain language.
Related triggers
These triggers work well alongside this one:
- Manual event received: Triggers when an event is fired on the Home Assistant event bus.