Assign label to device
labels_assign_label_to_deviceAssign a label to a Home Assistant device while keeping its existing labels. Appends the label ID and writes the full list back.
Instructions
Assign a label to a device, keeping its existing labels.
Reads the device's current labels list from the device registry,
appends label_id if not already present, and writes the full list
back via WS config/device_registry/update.
Use when: tagging one device with a label without disturbing labels
already on it.
Not for: removing a label — use labels_remove_label_from_device.
Returns: dict with device_id, the resulting labels list, the raw WS
result, and ok.
Errors: on a WS failure, returns {"device_id": ..., "label_id": ..., "ok": false, "error": "<message>"}.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"device_id": "<device_id>",
"label_id": "<label_id>"
},
"name": "labels_assign_label_to_device"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| label_id | Yes | Label registry ID to assign; obtain it from labels_list_labels. | |
| device_id | Yes | Device registry ID to tag; obtain it from devices_list_devices. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||