Set Entity
ha_set_entityUpdate Home Assistant entity registry fields like area, name, icon, device class, labels, aliases, and voice exposure, or rename entities and devices, in one call.
Instructions
Update entity properties in the entity registry.
Allows modifying entity metadata such as area assignment, display name, icon, "Show As" device class override, per-domain registry options, enabled/disabled state, visibility, aliases, labels, voice assistant exposure, and entity_id rename in a single call.
BULK OPERATIONS: When entity_id is a list, only labels, expose_to, and categories parameters are supported. Other parameters (area_id, name, icon, device_class, options, enabled, hidden, aliases, new_entity_id, new_device_name) require single entity.
LABEL OPERATIONS:
label_operation="set" (default): Replace all labels with the provided list. Use [] to clear.
label_operation="add": Add labels to existing ones without removing any.
label_operation="remove": Remove specified labels from the entity.
SHOW AS / DEVICE CLASS: device_class overrides the entity's display device class — equivalent to the HA UI's "Show As" dropdown. Use empty string '' to clear. Applies instantly, no reload needed.
REGISTRY OPTIONS: options carries per-domain registry options (sensor display_precision, weather forecast_type, etc). Pass {domain: {key: value}}; multi-domain dicts are sent as separate registry updates because HA's WS schema requires options_domain + options to be paired one domain at a time.
ENTITY ID RENAME: Use new_entity_id to change an entity's ID (e.g., sensor.old -> sensor.new). Domain must match. Voice exposure settings are preserved automatically.
WARNING: Renaming an entity_id does NOT update references in automations, scripts, templates, or dashboards. All consumers of the old entity_id must be updated manually — HA does not propagate the rename automatically.
Rename limitations:
Entity history is preserved (HA 2022.4+)
Entities without unique IDs cannot be renamed
Entities disabled by their integration cannot be renamed
DEVICE RENAME: Use new_device_name to rename the associated device. Can be combined with new_entity_id to rename both in one call. The device is looked up automatically.
Use ha_search() or ha_get_device() to find entity IDs. Use ha_config_get_label() to find available label IDs.
EXAMPLES: Single entity:
Assign to area: ha_set_entity("sensor.temp", area_id="living_room")
Rename display name: ha_set_entity("sensor.temp", name="Living Room Temperature")
Set Show As: ha_set_entity("binary_sensor.zone_10", device_class="window")
Clear Show As: ha_set_entity("binary_sensor.zone_10", device_class="")
Set sensor precision: ha_set_entity("sensor.power", options={"sensor": {"display_precision": 2}})
Rename entity_id: ha_set_entity("light.old_name", new_entity_id="light.new_name")
Rename entity and device: ha_set_entity("light.old", new_entity_id="light.new", new_device_name="New Lamp")
Rename entity_id with friendly name: ha_set_entity("sensor.old", new_entity_id="sensor.new", name="New Name")
Set labels: ha_set_entity("light.lamp", labels=["outdoor", "smart"])
Add labels: ha_set_entity("light.lamp", labels=["new_label"], label_operation="add")
Remove labels: ha_set_entity("light.lamp", labels=["old_label"], label_operation="remove")
Clear labels: ha_set_entity("light.lamp", labels=[])
Expose to Alexa: ha_set_entity("light.lamp", expose_to={"cloud.alexa": True})
Bulk operations:
Set labels on multiple: ha_set_entity(["light.a", "light.b"], labels=["outdoor"])
Add labels to multiple: ha_set_entity(["light.a", "light.b"], labels=["new"], label_operation="add")
Expose multiple to Alexa: ha_set_entity(["light.a", "light.b"], expose_to={"cloud.alexa": True})
ENABLED/DISABLED WARNING: Setting enabled=False performs a registry-level disable — the entity is completely removed from the Home Assistant state machine and hidden from the UI. It will NOT appear in state queries, dashboards, or automations until re-enabled AND the integration is reloaded. This is NOT the same as "turning off" an entity.
For automations and scripts, enabled=False is blocked. Use these instead:
ha_call_service("automation", "turn_off", entity_id="automation.xxx")
ha_call_service("script", "turn_off", entity_id="script.xxx")
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| icon | No | Icon for the entity (e.g., 'mdi:thermometer'). Use empty string '' to remove custom icon. Single entity only. | |
| name | No | Display name for the entity. Use empty string '' to remove custom name and revert to default. Single entity only. | |
| hidden | No | True to hide the entity from UI, False to show it. Single entity only. | |
| labels | No | List of label IDs for the entity. Behavior depends on label_operation parameter. Supports bulk operations. | |
| aliases | No | List of voice assistant aliases for the entity (replaces existing aliases). Single entity only. | |
| area_id | No | Area/room ID to assign the entity to. Use empty string '' to unassign from current area. Single entity only. | |
| enabled | No | True to enable the entity, False to disable it. Single entity only. WARNING: Setting enabled=False is a registry-level disable — it completely removes the entity from the state machine and hides it from the UI. A reload or restart is required to restore it after re-enabling. NOT allowed for automation or script entities — use automation.turn_off / script.turn_off via ha_call_service() instead. | |
| options | No | Per-domain entity registry options (e.g. sensor 'display_precision', weather 'forecast_type'). Pass a dict mapping domain to a sub-dict, e.g. {"sensor": {"display_precision": 2}}. Multiple domains are sent as separate registry updates. For 'Show As' use the dedicated `device_class` parameter — that is what the HA UI Show As dropdown writes. Voice-assistant exposure is stored under `options.<assistant>.should_expose` but must be managed via the dedicated `expose_to` parameter, not this options dict. Single entity only. | |
| entity_id | Yes | Entity ID or list of entity IDs to update. Bulk operations (list) only support labels, expose_to, and categories parameters. | |
| expose_to | No | Control voice assistant exposure. Pass a dict mapping assistant IDs to booleans. Valid assistants: 'conversation' (Assist), 'cloud.alexa', 'cloud.google_assistant'. Example: {"conversation": true, "cloud.alexa": false}. Supports bulk operations. | |
| categories | No | Category assignment as a dict mapping scope to category_id. Example: {"automation": "category_id_here"}. Use null value to clear: {"automation": null}. Single entity only. | |
| device_class | No | Override the entity's display device class — what the HA UI's 'Show As' dropdown writes. Use empty string '' to clear the override and fall back to the integration default. None (the default) means 'no change' — pass an explicit '' to clear. Single entity only. Examples: 'window', 'door', 'motion' for binary_sensor; 'temperature', 'humidity' for sensor. | |
| new_entity_id | No | New entity ID to rename to (e.g., 'light.new_name'). Domain must match the original. Single entity only. | |
| label_operation | No | How to apply labels: 'set' replaces all labels, 'add' adds to existing, 'remove' removes specified labels. | set |
| new_device_name | No | New display name for the associated device. If provided, both entity and device are updated in one operation. Single entity only. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||