# entity.unique_id.set

> **Generated from `RuleDefinition` metadata.** Edit only the section below the
> "HANDWRITTEN BELOW" marker; everything above is regenerated by
> `hasscheck docs-render`.

## Summary

Entity sets _attr_unique_id

## Why

A unique ID is required for entities to be tracked across restarts, to support entity customisation and to avoid duplicates in the entity registry. Note: this rule uses AST inspection; it checks for _attr_unique_id assignments at class level or via self._attr_unique_id in any platform file.

## Status behavior

| Field | Value |
|---|---|
| Category | modern_ha_patterns |
| Severity | recommended |
| Overridable | True |
| Version | 1.0.0 |

## Source

- https://developers.home-assistant.io/docs/entity_registry_index/#unique-id
- `source_checked_at`: 2026-05-01

<!-- HANDWRITTEN BELOW THIS LINE -->
