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:

  1. Go to Settings > Tags.
  2. Open the actions menu for the tag you want to use.
  3. Select Create automation.

To use this trigger in the automation editor:

  1. Go to Settings > Automations & scenes.
  2. Open an existing automation, or select Create automation > Create new automation.
  3. In the When section, select Add trigger.
  4. Select the type of trigger to add.
  5. Select Tag.
  6. In Tag, select the tag that should start the automation.
  7. Select Save.

Options in the UI

Tag (Required)

The tag that starts the automation when scanned.

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:

TriggerA trigger is a set of values or conditions of a platform that are defined to cause an automation to run. [Learn more]
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.

TriggerA trigger is a set of values or conditions of a platform that are defined to cause an automation to run. [Learn more]
trigger: tag
tag_id: "A7-6B-90-5F"
device_id: 0e19cd3cf2b311ea88f469a7512c307d

You can also provide multiple tag IDs or device IDs.

TriggerA trigger is a set of values or conditions of a platform that are defined to cause an automation to run. [Learn more]
trigger: tag
tag_id:
  - "A7-6B-90-5F"
  - "04-B1-C6-62-2F-64-80"
device_id:
  - 0e19cd3cf2b311ea88f469a7512c307d
  - 1234567890abcdef1234567890abcdef

Options in YAML

trigger string Required

The trigger type. For this trigger, use tag.

tag_id string | list Required

The ID of the tag to watch. You can use one tag ID or a list of tag IDs.

device_id string | list

The ID of the device or scanner that must scan the tag. You can use one device ID or a list of device IDs. If omitted, any device that scans the tag can start the automation.

Good to know

  • This trigger listens for tag_scanned events.
  • In YAML, device_id limits 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.

Tip

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
AutomationAutomations in Home Assistant allow you to automatically respond to things that happen in and around your home. [Learn more]
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
AutomationAutomations in Home Assistant allow you to automatically respond to things that happen in and around your home. [Learn more]
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.

Tip

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: