---
title: "Category management"
description: "Spook adds actions to Home Assistant to create, update and delete categories, and to file automations, scripts, scenes and helpers into them, all from your own automations and scripts."
canonical_url: "https://spook.boo/categories"
---
# Category management

> Spook adds actions to Home Assistant to create, update and delete categories, and to file automations, scripts, scenes and helpers into them, all from your own automations and scripts.

Categories in Home Assistant sort your automations, scripts, scenes, and helpers into groups on their own pages in the user interface. Each of those pages has its own set of categories, and something sits in one category per page.

Home Assistant lets you file things by hand, one at a time. Spook adds actions so your own automations and scripts can do it: file new automations away automatically, or tidy up a page full of them in one go.

## Actions

Spook adds five actions for categories. You find them wherever you add an action, marked with a 👻. They all belong to the Home Assistant Core Integration, so that is the name in front of them in the list.

Run by hand, these actions need a user that is an administrator. Your automations and scripts can always run them.

> **Tip:** **Categories by name**
> 
> Home Assistant never shows you the ID of a category, and it is a random one. So wherever an action below asks for a category, you type its name, like `Lighting`. Uppercase or lowercase does not matter.

### Create a category

Adds a new category to one of the pages: automations, scripts, scenes, or helpers.

Useful in a setup script that prepares the categories your other automations file things into, so they exist before anything needs them.

**How to use it**

1. Open the automation or script that should do this, and select **Add action**.
2. Search for **create a category**, and select **Home Assistant Core Integration: Create a category 👻**.
3. Under **Scope**, pick the page the category is for: **Automations**, **Helpers**, **Scenes**, or **Scripts**.
4. Give it a **Name**, like `Lighting`, and pick an **Icon** 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=homeassistant.create_category) opens it in your Home Assistant, ready to run once.

![The Actions tool with Create a category 👻 picked and filled in with an example.](https://spook.boo/images/screenshots/en/light/action-homeassistant-create-category.webp)

What **Try this action** opens, filled in with an example.

**Technical details**

| Action properties |
| --- |
| Action | Create a category 👻 |
| Action name | `homeassistant.create_category` |
| Action targets | No |
| Action response | Optional, the `category_id` of the new category |
| Spook's influence | Newly added action |
| Tools | [Try this action](https://my.home-assistant.io/redirect/developer_call_service/?service=homeassistant.create_category) [![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=homeassistant.create_category) |

| Action data parameters |
| --- |
| Attribute | Type | Required | Default / Example |
| `scope` | string | Yes | `automation` |
| `name` | string | Yes | `Lighting` |
| `icon` | string | No | `mdi:lightbulb` |

The `scope` is one of `automation`, `script`, `scene`, or `helpers`. The action responds with the ID of the new category, in case you want to use it right away.

**Example actions in YAML**

A Lighting category for automations, with the new ID kept in a variable:

```yaml
action: homeassistant.create_category
data:
  scope: automation
  name: Lighting
  icon: mdi:lightbulb
response_variable: category
```

**Known limitations**

- A name another category on the same page already has is refused. The same name on a different page is fine.

### Update a category

Changes the name or icon of a category that already exists.

Deleting a category and creating it again would take it off everything that was in it. A lot to lose over an icon. This changes the category and leaves everything in it where it is. Anything you leave out keeps the value it already has.

**How to use it**

1. Open the automation or script that should do this, and select **Add action**.
2. Search for **update a category**, and select **Home Assistant Core Integration: Update a category 👻**.
3. Under **Scope**, pick the page the category is on.
4. Under **Category**, type the name of the category to change.
5. Fill in only what should change: a new **Name**, a new **Icon**, or both.
6. Select **Save**.

Just want to see it work? [Try this action](https://my.home-assistant.io/redirect/developer_call_service/?service=homeassistant.update_category) opens it in your Home Assistant, ready to run once.

![The Actions tool with Update a category 👻 picked and filled in with an example.](https://spook.boo/images/screenshots/en/light/action-homeassistant-update-category.webp)

What **Try this action** opens, filled in with an example.

**Technical details**

| Action properties |
| --- |
| Action | Update a category 👻 |
| Action name | `homeassistant.update_category` |
| Action targets | No |
| Action response | No response |
| Spook's influence | Newly added action |
| Tools | [Try this action](https://my.home-assistant.io/redirect/developer_call_service/?service=homeassistant.update_category) [![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=homeassistant.update_category) |

| Action data parameters |
| --- |
| Attribute | Type | Required | Default / Example |
| `scope` | string | Yes | `automation` |
| `category_id` | string | Yes | `Lighting` |
| `name` | string | No | `Lights` |
| `icon` | string or `null` | No | `mdi:lightbulb-group` |

Setting `icon` to `null` clears it.

**Example actions in YAML**

Rename the Lighting category on the automations page to Lights:

```yaml
action: homeassistant.update_category
data:
  scope: automation
  category_id: Lighting
  name: Lights
```

**Known limitations**

- You need to give at least one thing to change. A call with only a `scope` and `category_id` is refused, so a misspelled field gives you an error.
- Renaming a category to a name another category on the same page already has is refused too.

### Delete a category

Removes a category from one of the pages.

For cleaning up the categories nobody uses anymore. Everything that was in it stays where it is, just without a category on that page.

**How to use it**

1. Open the automation or script that should do this, and select **Add action**.
2. Search for **delete a category**, and select **Home Assistant Core Integration: Delete a category 👻**.
3. Under **Scope**, pick the page the category is on.
4. Under **Category**, type the name of the category to delete.
5. Select **Save**.

Just want to see it work? [Try this action](https://my.home-assistant.io/redirect/developer_call_service/?service=homeassistant.delete_category) opens it in your Home Assistant, ready to run once.

![The Actions tool with Delete a category 👻 picked and filled in with an example.](https://spook.boo/images/screenshots/en/light/action-homeassistant-delete-category.webp)

What **Try this action** opens, filled in with an example.

**Technical details**

| Action properties |
| --- |
| Action | Delete a category 👻 |
| Action name | `homeassistant.delete_category` |
| Action targets | No |
| Action response | No response |
| Spook's influence | Newly added action |
| Tools | [Try this action](https://my.home-assistant.io/redirect/developer_call_service/?service=homeassistant.delete_category) [![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=homeassistant.delete_category) |

| Action data parameters |
| --- |
| Attribute | Type | Required | Default / Example |
| `scope` | string | Yes | `automation` |
| `category_id` | string | Yes | `Lighting` |

**Example actions in YAML**

Delete the Lighting category from the automations page:

```yaml
action: homeassistant.delete_category
data:
  scope: automation
  category_id: Lighting
```

**Known limitations**

- There is no undo. Creating the category again gives you the category back, not what was in it.

### Add a category to an entity

Puts one or more automations, scripts, scenes, or helpers in a category.

The pages in Home Assistant let you file things by hand. This lets a script or automation do it. The script that sets up your alarm files its helpers under "Security" while it is at it.

There is no **Scope** to pick here: the page follows from what you file. An automation goes into an automation category, a script into a script category, a scene into a scene category, and anything else counts as a helper. Since something sits in one category per page, this replaces the category it was in before.

**How to use it**

1. Open the automation or script that should do this, and select **Add action**.
2. Search for **add a category to an entity**, and select **Home Assistant Core Integration: Add a category to an entity 👻**.
3. Under **Category**, type the name of the category, like `Lighting`.
4. Under **Entity ID**, pick the automations, scripts, scenes, or helpers to put in it.
5. Select **Save**.

Just want to see it work? [Try this action](https://my.home-assistant.io/redirect/developer_call_service/?service=homeassistant.add_category_to_entity) opens it in your Home Assistant, ready to run once.

![The Actions tool with Add a category to an entity 👻 picked and filled in with an example.](https://spook.boo/images/screenshots/en/light/action-homeassistant-add-category-to-entity.webp)

What **Try this action** opens, filled in with an example.

**Technical details**

| Action properties |
| --- |
| Action | Add a category to an entity 👻 |
| Action name | `homeassistant.add_category_to_entity` |
| Action targets | No |
| Action response | No response |
| Spook's influence | Newly added action |
| Tools | [Try this action](https://my.home-assistant.io/redirect/developer_call_service/?service=homeassistant.add_category_to_entity) [![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=homeassistant.add_category_to_entity) |

| Action data parameters |
| --- |
| Attribute | Type | Required | Default / Example |
| `category_id` | string | Yes | `Lighting` |
| `entity_id` | string \| list of strings | Yes | `automation.porch_lights` |

Every entity, and the category for each of them, is looked up before anything changes. If one of them does not exist, the action stops with an error that names it, and nothing is changed.

**Example actions in YAML**

File two automations under Lighting:

```yaml
action: homeassistant.add_category_to_entity
data:
  category_id: Lighting
  entity_id:
    - automation.porch_lights
    - automation.garden_lights
```

**Known limitations**

- The category has to exist on the page of every entity you pick. Filing an automation and a script under `Lighting` in one go needs a Lighting category on the automations page and one on the scripts page.

### Remove a category from an entity

Takes one or more automations, scripts, scenes, or helpers out of a category.

The other half of [Add a category to an entity](#add-a-category-to-an-entity). Anything you pick that is in a different category is left alone, so you can safely aim it at a whole list.

**How to use it**

1. Open the automation or script that should do this, and select **Add action**.
2. Search for **remove a category from an entity**, and select **Home Assistant Core Integration: Remove a category from an entity 👻**.
3. Under **Category**, type the name of the category, like `Lighting`.
4. Under **Entity ID**, pick the automations, scripts, scenes, or helpers to take out of it.
5. Select **Save**.

Just want to see it work? [Try this action](https://my.home-assistant.io/redirect/developer_call_service/?service=homeassistant.remove_category_from_entity) opens it in your Home Assistant, ready to run once.

![The Actions tool with Remove a category from an entity 👻 picked and filled in with an example.](https://spook.boo/images/screenshots/en/light/action-homeassistant-remove-category-from-entity.webp)

What **Try this action** opens, filled in with an example.

**Technical details**

| Action properties |
| --- |
| Action | Remove a category from an entity 👻 |
| Action name | `homeassistant.remove_category_from_entity` |
| Action targets | No |
| Action response | No response |
| Spook's influence | Newly added action |
| Tools | [Try this action](https://my.home-assistant.io/redirect/developer_call_service/?service=homeassistant.remove_category_from_entity) [![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=homeassistant.remove_category_from_entity) |

| Action data parameters |
| --- |
| Attribute | Type | Required | Default / Example |
| `category_id` | string | Yes | `Lighting` |
| `entity_id` | string \| list of strings | Yes | `automation.porch_lights` |

Every entity, and the category for each of them, is looked up before anything changes. If one of them does not exist, the action stops with an error that names it, and nothing is changed.

**Example actions in YAML**

Take an automation out of Lighting:

```yaml
action: homeassistant.remove_category_from_entity
data:
  category_id: Lighting
  entity_id: automation.porch_lights
```

## Blueprints & tutorials

There are no known blueprints or tutorials for these actions yet. Made one, or found one? [Let us know in our discussion forums](https://github.com/frenck/spook/discussions).

## Feature requests, ideas, and support

Got an idea to take this further, like a new action, entity or repair? [Let us know in our discussion forums](https://github.com/frenck/spook/discussions).

Stuck, or found a bug? The [Support](https://spook.boo/support) page tells you where to go for help.


## Sitemap

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