---
title: "Tag"
description: "Spook adds actions to create, change and delete the NFC tags and QR codes Home Assistant knows, from your automations and scripts, without a trip to the Tags page."
canonical_url: "https://spook.boo/tag"
---
# Tag

> Spook adds actions to create, change and delete the NFC tags and QR codes Home Assistant knows, from your automations and scripts, without a trip to the Tags page.

The tag integration in Home Assistant knows the NFC tags and QR codes you scan with your phone. Every tag has an ID, written on the tag itself, and a name, and scanning one can start an automation. You find them under **Settings** > **Tags**.

Home Assistant lets you add, rename and delete tags on the Tags page, by hand. Spook adds actions for it, so an automation or a script can do the same: add the tag for a new sticker, give it a name and a description, and delete it again. An [assistant](https://spook.boo/assistants) with Spook's tools can do all three too.

## Actions

Spook adds three actions for tags. You find them wherever you add an action, marked with a 👻. All three are for administrators only, the same as the Tags page.

Every tag has an entity, which Home Assistant names after the tag, and which shows when it was last scanned. The actions leave that the way the Tags page does: a new tag gets one, a new name renames it, and deleting a tag deletes it too.

### Create a tag

Creates a new tag, the same as adding one on the Tags page.

You stuck a new NFC sticker next to the front door. Writing it with your phone gives it an ID, and Home Assistant adds the tag the first time it is scanned, without a name. With this action, the tag is there before that, with the name and description you want.

**How to use it**

1. Open the automation or script that should create the tag, and select **Add action**.
2. Search for **create a tag**, and select **Tag: Create a tag 👻**.
3. Fill in **Name**, like `Front door`.
4. Fill in the **Tag ID** that is on the tag, and a **Description** if you like.
5. Select **Save**.

Just want to see it work? [Try this action](https://my.home-assistant.io/redirect/developer_call_service/?service=tag.create) opens it in your Home Assistant, ready to run once. Mind you: running it creates the tag for real.

**Technical details**

| Action properties |
| --- |
| Action | Tag: Create a tag 👻 |
| Action name | `tag.create` |
| Action targets | No targets |
| Action response | Optional, the `entity_id` and `tag_id` of the new tag |
| Spook's influence | Newly added action |
| Tools | [Try this action](https://my.home-assistant.io/redirect/developer_call_service/?service=tag.create) [![Open your Home Assistant instance and show the Actions tool with a specific action selected.](https://my.home-assistant.io/badges/developer_call_service.svg)](https://my.home-assistant.io/redirect/developer_call_service/?service=tag.create) |

| Action data parameters |
| --- |
| Attribute | Type | Required | Default / Example |
| `name` | string | Yes | `Front door` |
| `tag_id` | string | No | `04-91-5c-22-7f-61-80` |
| `description` | string | No | `The NFC sticker next to the front door` |

Without a `tag_id`, Home Assistant makes one up, the same as the Tags page does when you leave it out. The response gives you the ID it made, to write on a tag. A `tag_id` another tag already has is refused.

The entity ID follows the name, as it does in the UI, and gets a number at the end if that name is already taken. A tag needs a name: the Tags page does not save one without either.

**Example actions in YAML**

The NFC sticker next to the front door:

```yaml
action: tag.create
data:
  name: "Front door"
  tag_id: "04-91-5c-22-7f-61-80"
  description: "The NFC sticker next to the front door"
response_variable: created
```

The new tag's entity ID is then in `{{ created.entity_id }}`, and its ID in `{{ created.tag_id }}`.

**Known limitations**

- This makes the tag Home Assistant knows, it does not write a tag. Write the ID on the tag with the companion app.
- The ID of a tag cannot change afterwards: it is what the tag says when it is scanned.
- This takes an admin when a user calls it. Automations and scripts are not affected.

### Delete a tag

Deletes one or more tags, with their entities, disabled ones included.

The other half of [Create a tag](#create-a-tag): the sticker came off the door, or the QR code went out with the old fridge. Everything in the list is checked first: if one of them cannot be deleted, none of them are.

**How to use it**

1. Open the automation or script that should delete the tag, and select **Add action**.
2. Search for **delete a tag**, and select **Tag: Delete a tag 👻**.
3. Under **Entity ID**, choose the tags to delete.
4. Select **Save**.

Just want to see it work? [Try this action](https://my.home-assistant.io/redirect/developer_call_service/?service=tag.delete) opens it in your Home Assistant, ready to run once. Mind you: running it deletes the tag for real.

**Technical details**

| Action properties |
| --- |
| Action | Tag: Delete a tag 👻 |
| Action name | `tag.delete` |
| Action targets | No targets |
| Action response | No response |
| Spook's influence | Newly added action |
| Tools | [Try this action](https://my.home-assistant.io/redirect/developer_call_service/?service=tag.delete) [![Open your Home Assistant instance and show the Actions tool with a specific action selected.](https://my.home-assistant.io/badges/developer_call_service.svg)](https://my.home-assistant.io/redirect/developer_call_service/?service=tag.delete) |

| Action data parameters |
| --- |
| Attribute | Type | Required | Default / Example |
| `entity_id` | string \| list of strings | Yes | `tag.front_door` |

A tag goes by its entity, which every tag has. The tag ID is in the attributes of that entity, when you only know the ID.

**Example actions in YAML**

Delete the front door tag:

```yaml
action: tag.delete
data:
  entity_id: tag.front_door
```

**Known limitations**

- Scanning a deleted tag adds it again, without a name, the same as for a tag Home Assistant never knew.
- An automation started by scanning the tag goes by its ID, not by the tag Home Assistant knows. Deleting the tag does not stop it running when the tag is scanned.
- This takes an admin when a user calls it. Automations and scripts are not affected.

### Update a tag

Changes the name or description of tags, the same as editing them on the Tags page. The change stays, through a reload and a restart.

A tag added by scanning it has no name, only its ID. Or the sticker moved from the front door to the back door. Without this action, that is a trip to the Tags page. With it, the script that sorts out your tags does it too.

**How to use it**

1. Open the automation or script that should change the tag, and select **Add action**.
2. Search for **update a tag**, and select **Tag: Update a tag 👻**.
3. Under **Targets**, choose the tag.
4. Fill in what should change: **Name** or **Description**. What you leave out stays as it is.
5. Select **Save**.

Just want to see it work? [Try this action](https://my.home-assistant.io/redirect/developer_call_service/?service=tag.update) opens it in your Home Assistant, ready to run once. Mind you: running it changes the tag for real.

**Technical details**

| Action properties |
| --- |
| Action | Tag: Update a tag 👻 |
| Action name | `tag.update` |
| Action targets | Yes, `tag` entities |
| Action response | No response |
| Spook's influence | Newly added action |
| Tools | [Try this action](https://my.home-assistant.io/redirect/developer_call_service/?service=tag.update) [![Open your Home Assistant instance and show the Actions tool with a specific action selected.](https://my.home-assistant.io/badges/developer_call_service.svg)](https://my.home-assistant.io/redirect/developer_call_service/?service=tag.update) |

| Action data parameters |
| --- |
| Attribute | Type | Required | Default / Example |
| `name` | string | No | `Back door` |
| `description` | string | No | `The NFC sticker next to the back door` |

Give at least one field. What is given goes on top of what the tag has, and what is left out keeps what it has. A tag keeps its name on its entity, the same name you see in the settings of that entity: a new name renames the entity, not its entity ID. With more than one tag, each gets the change, and a tag that already has it is left alone.

A `description` of `null` empties the description. Home Assistant has no way to take one away completely.

**Example actions in YAML**

The sticker moved to the back door:

```yaml
action: tag.update
target:
  entity_id: tag.front_door
data:
  name: "Back door"
  description: "The NFC sticker next to the back door"
```

**Known limitations**

- The ID of a tag stays what it is: it is what the tag says when it is scanned.
- The entity ID stays what it is. To change it too, use [Entity: Update ID](https://spook.boo/actions#entity-update-id).
- This takes an admin when a user calls it. Automations and scripts are not affected.

## Use cases

What people use this for:

- Add the tag for a new NFC sticker before its first scan, with a name and a description that says where it is.
- Give the tags that were added by scanning them a proper name in one go.
- Clean up the tags of stickers that are gone.


## Sitemap

See the full [sitemap](https://spook.boo/sitemap.md) for all pages.
