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.
Actions¶
Spook adds the following new actions to your Home Assistant instance:
Create a label¶
Adds a new label to your Home Assistant instance.
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.
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.
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.
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.
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.
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.
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.
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.