Skip to content

Deprecate friendlyName - #120

Merged
bgoncal merged 4 commits into
mainfrom
deprecate-friendly-name
Jul 28, 2026
Merged

bgoncal merged 4 commits into
mainfrom
deprecate-friendly-name

Conversation

@bgoncal

@bgoncal bgoncal commented Jul 28, 2026 •

Copy link
Copy Markdown
Member

Summary

Marks the friendlyName entity attribute accessor as deprecated. The friendly_name state attribute isn't the canonical display name — it doesn't reflect entity/device registry names or user customizations. The display name should be resolved from the entity registry list_for_display endpoint instead (not mapped in HAKit; see home-assistant/core and home-assistant/frontend).

The accessor still works; consumers now get a deprecation warning pointing to the replacement.

Also wraps a few single-line if bodies that SwiftFormat now flags, so lint passes.

@codecov

codecov Bot commented Jul 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.83%. Comparing base (02777d0) to head (e5c50e8).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #120   +/-   ##
=======================================
  Coverage   99.83%   99.83%           
=======================================
  Files          53       53           
  Lines        1822     1824    +2     
=======================================
+ Hits         1819     1821    +2     
  Misses          3        3           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Deprecates the HAEntityAttributes.friendlyName accessor to discourage using the non-canonical friendly_name state attribute as an entity display name, and updates a few code paths/tests to satisfy SwiftFormat and improve service definition parsing.

Changes:

  • Mark HAEntityAttributes.friendlyName as deprecated with guidance to use entity registry list_for_display data instead.
  • Treat empty service name/description strings as nil when decoding service definitions, with added test coverage.
  • Reformat single-line if bodies in tests to satisfy SwiftFormat.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
Tests/Services.test.swift Adds coverage ensuring empty service descriptions are treated as nil.
Tests/HAURLSessionWebSocketEngine.test.swift Rewraps if bodies in closures to satisfy SwiftFormat without changing test intent.
Source/Data/HAEntity.swift Deprecates friendlyName with a detailed warning about canonical display-name resolution.
Source/Convenience/Services.swift Treats empty decoded name/description as nil to normalize service definitions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Source/Data/HAEntity.swift Outdated
@bgoncal
bgoncal merged commit 94b4f79 into main Jul 28, 2026
6 of 7 checks passed
@bgoncal
bgoncal deleted the deprecate-friendly-name branch July 28, 2026 14:30
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.

2 participants