Assign label to entity
labels_assign_label_to_entityTag a Home Assistant entity with a label, preserving all existing labels. Reads current labels, appends the new label ID, and writes the updated list back via WebSocket.
Instructions
Assign a label to an entity, keeping its existing labels.
Reads the entity's current labels list from the entity registry,
appends label_id if not already present, and writes the full list
back via WS config/entity_registry/update.
Use when: tagging one entity with a label without disturbing labels
already on it.
Not for: removing a label — use labels_remove_label_from_entity.
Returns: dict with entity_id, the resulting labels list, the raw WS
result, and ok.
Errors: on a WS failure, returns {"entity_id": ..., "label_id": ..., "ok": false, "error": "<message>"}.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| label_id | Yes | Label registry ID to assign; obtain it from labels_list_labels. | |
| entity_id | Yes | Entity ID to tag, e.g. 'light.kitchen'. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||