Consider next name part when unprefixing entity name by arturpragacz · Pull Request #184526 · home-assistant/core · GitHub
Skip to content

Consider next name part when unprefixing entity name - #184526

Merged
MindFreeze merged 2 commits into
devfrom
ap/h/entity_registry/consider-next-name-part-when-unprefixing-entity-name
Oct 7, 2026
Merged

MindFreeze merged 2 commits into
devfrom
ap/h/entity_registry/consider-next-name-part-when-unprefixing-entity-name

Conversation

@arturpragacz

@arturpragacz arturpragacz commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Proposed change

Consider next name part when unprefixing entity name.

The device name prefix is stripped from a user-set entity name only when the device is a name part of the entity, i.e. when next_name_part is device, matching the full name computation.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

@arturpragacz arturpragacz added this to the 2026.10.0 milestone Oct 6, 2026
@arturpragacz
arturpragacz requested a review from a team as a code owner October 6, 2026 19:26
Copilot AI balanced review requested due to automatic review settings October 6, 2026 19:26
@home-assistant home-assistant Bot added bugfix cla-signed core small-pr PRs with less than 30 lines. labels Oct 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The focused logic correction is consistent with naming-chain semantics and is covered by the updated regression test.

Review effort: Balanced
Findings: None

What changed in this PR

Updates entity-name validation so device prefixes are considered only when the naming chain includes the device.

Changes:

  • Respect next_name_part when unprefixing entity names.
  • Test assigning an own area with a name matching the device.
File Description
homeassistant/​helpers/​entity_registry.py Limits device-name stripping to device-linked names.
tests/​helpers/​test_entity_registry.py Verifies own-area naming behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@arturpragacz arturpragacz reopened this Oct 6, 2026
Copilot AI balanced review requested due to automatic review settings October 6, 2026 21:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The focused change matches the naming model and is covered by the updated regression test.

Review effort: Balanced
Findings: None

@MindFreeze
MindFreeze merged commit 9790e32 into dev Oct 7, 2026
55 of 59 checks passed
@MindFreeze
MindFreeze deleted the ap/h/entity_registry/consider-next-name-part-when-unprefixing-entity-name branch October 7, 2026 05:39
frenck pushed a commit that referenced this pull request Oct 7, 2026
Co-authored-by: Robert Resch <robert@resch.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants