Skip to main content
Glama
homeassistant-ai

Home Assistant MCP Server

Official

Set Entity

ha_set_entity
DestructiveIdempotent

Modify Home Assistant entities: change name, area, icon, device class, labels, enable/disable, rename entity_id, and control voice exposure. Supports bulk label/exposure updates.

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

TableJSON Schema
NameRequiredDescriptionDefault
iconNoIcon for the entity (e.g., 'mdi:thermometer'). Use empty string '' to remove custom icon. Single entity only.
nameNoDisplay name for the entity. Use empty string '' to remove custom name and revert to default. Single entity only.
hiddenNoTrue to hide the entity from UI, False to show it. Single entity only.
labelsNoList of label IDs for the entity. Behavior depends on label_operation parameter. Supports bulk operations.
aliasesNoList of voice assistant aliases for the entity (replaces existing aliases). Single entity only.
area_idNoArea/room ID to assign the entity to. Use empty string '' to unassign from current area. Single entity only.
enabledNoTrue 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.
optionsNoPer-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_idYesEntity ID or list of entity IDs to update. Bulk operations (list) only support labels, expose_to, and categories parameters.
expose_toNoControl 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.
categoriesNoCategory 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_classNoOverride 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_idNoNew entity ID to rename to (e.g., 'light.new_name'). Domain must match the original. Single entity only.
label_operationNoHow to apply labels: 'set' replaces all labels, 'add' adds to existing, 'remove' removes specified labels.set
new_device_nameNoNew display name for the associated device. If provided, both entity and device are updated in one operation. Single entity only.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations indicate idempotent and destructive hints; the description adds critical behavioral details: enabling/disabling is registry-level (requires reload), rename doesn't update references, label operations semantics, and multi-domain options handling. No contradiction with annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Well-structured with sections, bullet points, and examples. Front-loaded with a clear summary. Slightly verbose due to many examples, but every section serves a purpose. Could be trimmed slightly, but still very effective.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers all 15 parameters, bulk restrictions, warnings (enabled=False, rename propagation), and cross-references sibling tools. With output schema present, it provides comprehensive context for complex entity registry operations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 100% schema coverage, the description still adds significant value: explains label_operation enum, device_class 'Show As' usage, options multi-domain handling, expose_to valid assistants, rename limitations, and device rename combination. Goes far beyond schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Update entity properties in the entity registry' and lists specific modifiable aspects (area, name, icon, etc.). It distinguishes from siblings like ha_get_entity (read), ha_remove_entity (delete), and ha_set_device (device-level) by focusing on entity registry properties.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly covers when to use (single vs bulk), when not to use (e.g., enabled=False for automations/scripts, alternatives provided via ha_call_service()), and includes examples for each operation. Clearly differentiates single entity and bulk operations.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/homeassistant-ai/ha-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server