Deprecate friendlyName - #120
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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.friendlyNameas deprecated with guidance to use entity registrylist_for_displaydata instead. - Treat empty service
name/descriptionstrings asnilwhen decoding service definitions, with added test coverage. - Reformat single-line
ifbodies 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Marks the
friendlyNameentity attribute accessor as deprecated. Thefriendly_namestate 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 registrylist_for_displayendpoint instead (not mapped in HAKit; seehome-assistant/coreandhome-assistant/frontend).The accessor still works; consumers now get a deprecation warning pointing to the replacement.
Also wraps a few single-line
ifbodies that SwiftFormat now flags, so lint passes.