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 service calls in for example automations, or scripts.
Spook provides services 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.
Services¶
Spook adds the following new service to your Home Assistant instance:
Create a label¶
Adds a new label to your Home Assistant instance.
Service properties | |
---|---|
Service | Create an label đź‘» |
Service name | homeassistant.create_label |
Service targets | No |
Service response | No response |
Spook's influence | Newly added service |
Developer tools | Try this service |
Service call data | |||
---|---|---|---|
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 |
Example service call in YAML
1 2 3 4 5 6
service: 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.
Service properties | |
---|---|
Service | Delete a label đź‘» |
Service name | homeassistant.delete_label |
Service targets | No |
Service response | No response |
Spook's influence | Newly added service |
Developer tools | Try this service |
Service call data | |||
---|---|---|---|
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”.
Example service call in YAML
1 2 3
service: homeassistant.delete_label data: label_id: "battery_powered"
Same example, but using the label’s name instead of the label ID:
1 2 3
service: 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.
Service properties | |
---|---|
Service | Add a label to an area đź‘» |
Service name | homeassistant.add_label_to_area |
Service targets | No |
Service response | No response |
Spook's influence | Newly added service |
Developer tools | Try this service |
Service call data | |||
---|---|---|---|
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”.
Example service call in YAML
1 2 3 4
service: 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
service: 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
service: 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.
Service properties | |
---|---|
Service | Remove a label from an area đź‘» |
Service name | homeassistant.remove_label_from_area |
Service targets | No |
Service response | No response |
Spook's influence | Newly added service |
Developer tools | Try this service |
Service call data | |||
---|---|---|---|
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”.
Example service call in YAML
1 2 3 4
service: 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
service: 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
service: 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.
Service properties | |
---|---|
Service | Add a label to a device đź‘» |
Service name | homeassistant.add_label_to_device |
Service targets | No |
Service response | No response |
Spook's influence | Newly added service |
Developer tools | Try this service |
Service call data | |||
---|---|---|---|
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 service 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
.
Example service call in YAML
1 2 3 4
service: 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
service: 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
service: 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.
Service properties | |
---|---|
Service | Remove a label from a device đź‘» |
Service name | homeassistant.remove_label_from_device |
Service targets | No |
Service response | No response |
Spook's influence | Newly added service |
Developer tools | Try this service |
Service call data | |||
---|---|---|---|
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 service 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
.
Example service call in YAML
1 2 3 4
service: 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
service: 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
service: 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.
Service properties | |
---|---|
Service | Add a label to an entity đź‘» |
Service name | homeassistant.add_label_to_entity |
Service targets | No |
Service response | No response |
Spook's influence | Newly added service |
Developer tools | Try this service |
Service call data | |||
---|---|---|---|
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”.
Example service call in YAML
1 2 3 4
service: 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
service: 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
service: 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.
Service properties | |
---|---|
Service | Remove a label from an entity đź‘» |
Service name | homeassistant.remove_label_from_entity |
Service targets | No |
Service response | No response |
Spook's influence | Newly added service |
Developer tools | Try this service |
Service call data | |||
---|---|---|---|
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”.
Example service call in YAML
1 2 3 4
service: 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
service: 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
service: 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 service, 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.