Labels in Home Assistant can be freely created / be made up by you and used to create your own organizational structure by tagging devices, entities, or areas with one or more labels. Labels can be used to filter items shows in tables in the user interface, or to target actions in for example automations, or scripts.
Spook provides that allows you to manage and automate the areas in Home Assistant programatically. Great for creating “dynamic” labels, or for creating labels on the fly.
![Screenshot of the developer actions tools, listing the new actions to manage labels.](/build/example-0845f02701a41e6dfbc6c2bde9d740ef.png)
Actions¶
Spook adds the following new actions to your Home Assistant instance:
Create a label¶
Adds a new label to your Home Assistant instance.
![Screenshot of the create label action in the developer tools.](/build/create-0a55c2a7eb5869b8ac3f166a22b419e8.png)
Action properties | |
---|---|
Action | Create an label đź‘» |
Action name | homeassistant.create_label |
Action targets | No |
Action response | No response |
Spook's influence | Newly added action |
Developer tools | Try this action
|
Action data parameters | |||
---|---|---|---|
Attribute | Type | Required | Default / Example |
name | string | Yes | Battery powered |
description | string | No | Label to tag all battery powered devices |
icon | string | No | mdi:battery |
color | string | No | indigo |
1 2 3 4 5 6
action: homeassistant.create_label data: name: "Battery powered" description: "Label to tag all battery powered devices" icon: "mdi:battery" color: "indigo"
Delete a label¶
Delete a new label to your Home Assistant instance.
![Screenshot of the delete label action in the developer tools.](/build/delete-33c3f834494c2a395cabe3d3e8da7e71.png)
Action properties | |
---|---|
Action | Delete a label đź‘» |
Action name | homeassistant.delete_label |
Action targets | No |
Action response | No response |
Spook's influence | Newly added action |
Developer tools | Try this action
|
Action data parameters | |||
---|---|---|---|
Attribute | Type | Required | Default / Example |
label_id | string | Yes | battery_powered |
Getting an label ID from a label name
Not sure what the label_id
of an label is? The label_id
field also accepts templates. You can use this template to use the label’s name instead:
label_id: "{{ label_id('Battery powered') }}"
That template will find the label ID of the label with the name “Battery powered”.
1 2 3
action: homeassistant.delete_label data: label_id: "battery_powered"
Same example, but using the label’s name instead of the label ID:
1 2 3
action: homeassistant.delete_label data: label_id: "{{ label_id('Battery powered') }}"
Add a label to an area¶
Adds one or more labels(s) to an area.
![Screenshot of the add a label to an area action in the developer tools.](/build/add_to_area-f299ce231be94033a72ad46ff606e73b.png)
Action properties | |
---|---|
Action | Add a label to an area đź‘» |
Action name | homeassistant.add_label_to_area |
Action targets | No |
Action response | No response |
Spook's influence | Newly added action |
Developer tools | Try this action
|
Action data parameters | |||
---|---|---|---|
Attribute | Type | Required | Default / Example |
label_id | string | list of strings | Yes | living_space |
area_id | string | list of strings | Yes | living_room |
Getting an label ID from a label name
Not sure what the label_id
of an label is? The label_id
field also accepts templates. You can use this template to use the label’s name instead:
label_id: "{{ label_id('Living space') }}"
That template will find the label ID of the label with the name “Living space”.
Getting an area ID from an area name
Not sure what the area_id
of an area is? The area_id
field also accepts templates. You can use this template to use the area’s name instead:
area_id: "{{ area_id('Living room') }}"
That template will find the area ID of the area with the name “Living room”.
1 2 3 4
action: homeassistant.add_label_to_area data: label_id: "living_space" area_id: "living_room"
Same example, but using the area’s and label’s name instead of their IDs:
1 2 3 4
action: homeassistant.add_label_to_area data: label_id: "{{ label_id('Living space') }}" area_id: "{{ area_id('Living room') }}"
You can use multiple labels and areas at once. This will cause each label to be added to each area:
1 2 3 4 5 6 7 8
action: homeassistant.add_label_to_area data: label_id: - "living_space" - "chill_zone" area_id: - "living_room" - "games_room"
Remove a label from an area¶
Removes one or more label(s) from an area.
![Screenshot of the remove a label from an area action in the developer tools.](/build/remove_from_area-365f10f6b3f9bb7b16f4ff8f850dbf56.png)
Action properties | |
---|---|
Action | Remove a label from an area đź‘» |
Action name | homeassistant.remove_label_from_area |
Action targets | No |
Action response | No response |
Spook's influence | Newly added action |
Developer tools | Try this action
|
Action data parameters | |||
---|---|---|---|
Attribute | Type | Required | Default / Example |
label_id | string | list of strings | Yes | living_space |
area_id | string | list of strings | Yes | living_room |
Getting an label ID from a label name
Not sure what the label_id
of an label is? The label_id
field also accepts templates. You can use this template to use the label’s name instead:
label_id: "{{ label_id('Living space') }}"
That template will find the label ID of the label with the name “Living space”.
Getting an area ID from an area name
Not sure what the area_id
of an area is? The area_id
field also accepts templates. You can use this template to use the area’s name instead:
area_id: "{{ area_id('Living room') }}"
That template will find the area ID of the area with the name “Living room”.
1 2 3 4
action: homeassistant.remove_label_from_area data: label_id: "living_space" area_id: "living_room"
Same example, but using the area’s and label’s name instead of their IDs:
1 2 3 4
action: homeassistant.remove_label_from_area data: label_id: "{{ label_id('Living space') }}" area_id: "{{ area_id('Living room') }}"
You can use multiple labels and areas at once. This will cause each label to be removed from each area:
1 2 3 4 5 6 7 8
action: homeassistant.remove_label_from_area data: label_id: - "living_space" - "chill_zone" area_id: - "living_room" - "games_room"
Add a label to a device¶
Adds one or more labels(s) to a device.
![Screenshot of the add a label to a device action in the developer tools.](/build/add_to_device-531e83a7adac416adb6fa4d50b617ed5.png)
Action properties | |
---|---|
Action | Add a label to a device đź‘» |
Action name | homeassistant.add_label_to_device |
Action targets | No |
Action response | No response |
Spook's influence | Newly added action |
Developer tools | Try this action
|
Action data parameters | |||
---|---|---|---|
Attribute | Type | Required | Default / Example |
label_id | string | list of strings | Yes | battery_powered |
device_id | string | list of strings | Yes | dc23e666e6100f184e642a0ac345d3eb |
Getting an label ID from a label name
Not sure what the label_id
of an label is? The label_id
field also accepts templates. You can use this template to use the label’s name instead:
label_id: "{{ label_id('Battery powered') }}"
That template will find the label ID of the label with the name “Battery powered”.
Finding a device ID
Not sure what the device_id
of an your device is? There are a few ways to find it:
Use this action in the developer tools, in the UI select the device you want to add and select the Go to YAML mode button. This will show you the device ID in the YAML code.
Alternatively, you can visit the device page in the UI and look at the URL. The device ID is the last part of the URL, and will look something like this: dc23e666e6100f184e642a0ac345d3eb
.
1 2 3 4
action: homeassistant.add_label_to_device data: label_id: "battery_powered" device_id: "dc23e666e6100f184e642a0ac345d3eb"
Same example, but using the label’s name instead of its ID:
1 2 3 4
action: homeassistant.add_label_to_device data: label_id: "{{ label_id('Battery powered') }}" device_id: "dc23e666e6100f184e642a0ac345d3eb"
You can use multiple labels and devices at once. This will cause each label to be added to each device:
1 2 3 4 5 6 7 8
action: homeassistant.add_label_to_device data: label_id: - "battery_powered" - "cr2023" device_id: - "dc23e666e6100f184e642a0ac345d3eb" - "df98a97c9341a0f184e642a0ac345d3b"
Remove a label from a device¶
Removes one or more label(s) from a device.
![Screenshot of the remove a label from a device action in the developer tools.](/build/remove_from_device-7617640d06db9b0a1a600daf603074a7.png)
Action properties | |
---|---|
Action | Remove a label from a device đź‘» |
Action name | homeassistant.remove_label_from_device |
Action targets | No |
Action response | No response |
Spook's influence | Newly added action |
Developer tools | Try this action
|
Action data parameters | |||
---|---|---|---|
Attribute | Type | Required | Default / Example |
label_id | string | list of strings | Yes | battery_powered |
device_id | string | list of strings | Yes | dc23e666e6100f184e642a0ac345d3eb |
Getting an label ID from a label name
Not sure what the label_id
of an label is? The label_id
field also accepts templates. You can use this template to use the label’s name instead:
label_id: "{{ label_id('Battery powered') }}"
That template will find the label ID of the label with the name “Battery powered”.
Finding a device ID
Not sure what the device_id
of an your device is? There are a few ways to find it:
Use this action in the developer tools, in the UI select the device you want to add and select the Go to YAML mode button. This will show you the device ID in the YAML code.
Alternatively, you can visit the device page in the UI and look at the URL. The device ID is the last part of the URL, and will look something like this: dc23e666e6100f184e642a0ac345d3eb
.
1 2 3 4
action: homeassistant.remove_label_from_device data: label_id: "battery_powered" device_id: "dc23e666e6100f184e642a0ac345d3eb"
Same example, but using the label’s name instead of its ID:
1 2 3 4
action: homeassistant.remove_label_from_device data: label_id: "{{ label_id('Battery powered') }}" device_id: "dc23e666e6100f184e642a0ac345d3eb"
You can use multiple labels and devices at once. This will cause each label to be removed from each device:
1 2 3 4 5 6 7 8
action: homeassistant.remove_label_from_device data: label_id: - "battery_powered" - "cr2023" device_id: - "dc23e666e6100f184e642a0ac345d3eb" - "df98a97c9341a0f184e642a0ac345d3b"
Add a label to an entity¶
Adds one or more labels(s) to an entity.
![Screenshot of the add a label to an entity action in the developer tools.](/build/add_to_entity-1f7b81302572c71f4df34358f4ec75a9.png)
Action properties | |
---|---|
Action | Add a label to an entity đź‘» |
Action name | homeassistant.add_label_to_entity |
Action targets | No |
Action response | No response |
Spook's influence | Newly added action |
Developer tools | Try this action
|
Action data parameters | |||
---|---|---|---|
Attribute | Type | Required | Default / Example |
label_id | string | list of strings | Yes | battery_powered |
entity_id | string | list of strings | Yes | sensor.outside_temperature |
Getting an label ID from a label name
Not sure what the label_id
of an label is? The label_id
field also accepts templates. You can use this template to use the label’s name instead:
label_id: "{{ label_id('Battery powered') }}"
That template will find the label ID of the label with the name “Battery powered”.
1 2 3 4
action: homeassistant.add_label_to_entity data: label_id: "battery_powered" entity_id: sensor.outside_temperature
Same example, but using the label’s name instead of its ID:
1 2 3 4
action: homeassistant.add_label_to_entity data: label_id: "{{ label_id('Battery powered') }}" entity_id: sensor.outside_temperature
You can use multiple labels and entities at once. This will cause each label to be added to each device:
1 2 3 4 5 6 7 8
action: homeassistant.add_label_to_entity data: label_id: - "battery_powered" - "cr2023" entity_id: - sensor.outside_temperature - sensor.inside_temperature
Remove a label from an entity¶
Removes one or more label(s) from an entity.
![Screenshot of the remove a label from an entity action in the developer tools.](/build/remove_from_entity-518aaa20d7cc7a0d26345a3426109c4f.png)
Action properties | |
---|---|
Action | Remove a label from an entity đź‘» |
Action name | homeassistant.remove_label_from_entity |
Action targets | No |
Action response | No response |
Spook's influence | Newly added action |
Developer tools | Try this action
|
Action data parameters | |||
---|---|---|---|
Attribute | Type | Required | Default / Example |
label_id | string | list of strings | Yes | battery_powered |
entity_id | string | list of strings | Yes | sensor.outside_temperature |
Getting an label ID from a label name
Not sure what the label_id
of an label is? The label_id
field also accepts templates. You can use this template to use the label’s name instead:
label_id: "{{ label_id('Battery powered') }}"
That template will find the label ID of the label with the name “Battery powered”.
1 2 3 4
action: homeassistant.remove_label_from_entity data: label_id: "battery_powered" entity_id: sensor.outside_temperature
Same example, but using the label’s name instead of its ID:
1 2 3 4
action: homeassistant.remove_label_from_entity data: label_id: "{{ label_id('Battery powered') }}" entity_id: sensor.outside_temperature
You can use multiple labels and devices at once. This will cause each label to be removed from each entity:
1 2 3 4 5 6 7 8
action: homeassistant.remove_label_from_entity data: label_id: - "battery_powered" - "cr2023" entity_id: - sensor.outside_temperature - sensor.inside_temperature
Blueprints & tutorials¶
There are currently no known blueprints or tutorials for the enhancements Spook provides for this integration. If you created one or stumbled upon one, please let us know in our discussion forums.
Features requests, ideas, and support¶
If you have an idea on how to further enhance this integration, for example, by adding a new action, entity, or repairs detection; feel free to let us know in our discussion forums.
Are you stuck using these new features? Or maybe you’ve run into a bug? Please check the page on where to go for help.