Skip to content

Remove friendly name usage from wear - #7247

Open
TimoPtr wants to merge 2 commits into
mainfrom
feature/wear_remove_friendly_name
Open

Remove friendly name usage from wear#7247
TimoPtr wants to merge 2 commits into
mainfrom
feature/wear_remove_friendly_name

Conversation

@TimoPtr

@TimoPtr TimoPtr commented Jul 23, 2026

Copy link
Copy Markdown
Member

Summary

This PR replace the usage of friendly name within the wear module by using the EntitiesDisplayManager.

Based on #7246

Checklist

  • New or updated tests have been added to cover the changes following the testing guidelines.
  • The code follows the project's code style and best_practices.
  • The changes have been thoroughly tested, and edge cases have been considered.
  • Changes are backward compatible whenever feasible. Any breaking changes are documented in the changelog for users and/or in the code for developers depending on the relevance.
  • I have read the Open Home Foundation AI Policy.

Select exactly one option that describes AI usage in this contribution:

  • I have not used AI for this contribution.
  • AI assistance was used for this contribution.
  • AI fully generated the code for this contribution, but I've reviewed and understood it before submitting and will respond without AI during review.

@TimoPtr
TimoPtr force-pushed the feature/friendly_state_better_unit_display branch from b97bb91 to 1969174 Compare July 23, 2026 15:47
@TimoPtr
TimoPtr force-pushed the feature/wear_remove_friendly_name branch from 93b4a4e to 7b758c4 Compare July 23, 2026 15:47
@TimoPtr TimoPtr linked an issue Jul 23, 2026 that may be closed by this pull request
@TimoPtr
TimoPtr force-pushed the feature/wear_remove_friendly_name branch from 7b758c4 to 830518c Compare July 23, 2026 16:04
@TimoPtr
TimoPtr force-pushed the feature/friendly_state_better_unit_display branch from 1969174 to 48f0d57 Compare July 27, 2026 11:52
@TimoPtr
TimoPtr force-pushed the feature/wear_remove_friendly_name branch from 830518c to 4ae19ef Compare July 27, 2026 11:52
@TimoPtr
TimoPtr force-pushed the feature/friendly_state_better_unit_display branch from 48f0d57 to c889a37 Compare July 28, 2026 10:01
@TimoPtr
TimoPtr requested a review from jpelgrom July 28, 2026 10:22
@TimoPtr
TimoPtr force-pushed the feature/wear_remove_friendly_name branch from 4ae19ef to 907d1a5 Compare July 28, 2026 10:22
@TimoPtr
TimoPtr requested a review from Copilot July 28, 2026 10:23

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.

Pull request overview

This pull request migrates the Wear OS module away from relying on the entity state attribute friendly_name by switching UI/components, tiles, and complications to use the display-resolution pipeline (EntitiesForDisplayManager / EntityDisplay*) so names/icons/states come from consistent display logic.

Changes:

  • Replaced Wear UI usage of raw Entity/attributes with EntityDisplay across lists, details, favorites, and entity pickers.
  • Updated Wear tiles/complications to render EntityDisplay.name and added climate control resolution via ClimateControls.
  • Renamed cached favorite column from friendly_namename with a Room auto-migration and schema bump.

Reviewed changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
wear/src/screenshotTest/kotlin/io/homeassistant/companion/android/EntityListViewPreviewsTest.kt Updates screenshot preview data to use EntityDisplayWithoutContext.
wear/src/main/kotlin/io/homeassistant/companion/android/views/ChooseEntityView.kt Switches entity picker from Entity attributes to EntityDisplay fields.
wear/src/main/kotlin/io/homeassistant/companion/android/util/WearToggleChip.kt Uses EntityDisplay (domain/position/color) for toggle chip gradient/background logic.
wear/src/main/kotlin/io/homeassistant/companion/android/util/CommonFunctions.kt Renames parameter from friendlyName to name for feedback/toast message formatting.
wear/src/main/kotlin/io/homeassistant/companion/android/tiles/ThermostatTile.kt Resolves thermostat tile entity via display pipeline and uses climateControls + name.
wear/src/main/kotlin/io/homeassistant/companion/android/tiles/ShortcutsTile.kt Replaces friendlyName rendering with EntityDisplay.name.
wear/src/main/kotlin/io/homeassistant/companion/android/home/views/SetThermostatTileView.kt Uses EntityDisplay for selected entity icon/name in thermostat tile config UI.
wear/src/main/kotlin/io/homeassistant/companion/android/home/views/SetShortcutsTileView.kt Updates shortcut config UI to use SimplifiedEntity.name.
wear/src/main/kotlin/io/homeassistant/companion/android/home/views/SetFavoriteView.kt Converts favorites selection UI from raw attributes to EntityDisplay.
wear/src/main/kotlin/io/homeassistant/companion/android/home/views/SetCameraTileView.kt Uses EntityDisplay for selected camera tile entity icon/name.
wear/src/main/kotlin/io/homeassistant/companion/android/home/views/MainView.kt Updates main list/navigation to use display-item maps and cached name.
wear/src/main/kotlin/io/homeassistant/companion/android/home/views/HomeView.kt Wires navigation/screens to new display-backed view state collections.
wear/src/main/kotlin/io/homeassistant/companion/android/home/views/EntityUi.kt Renders entity rows from EntityDisplay (name/icon/state) instead of attributes.
wear/src/main/kotlin/io/homeassistant/companion/android/home/views/EntityListView.kt Converts list view to EntityDisplay and updates previews accordingly.
wear/src/main/kotlin/io/homeassistant/companion/android/home/views/DetailsPanelView.kt Migrates detail panel sliders/controls to EntityDisplay control models.
wear/src/main/kotlin/io/homeassistant/companion/android/home/MainViewModel.kt Replaces raw entity/registry handling with EntitiesForDisplayManager.observeInContext.
wear/src/main/kotlin/io/homeassistant/companion/android/home/HomeActivity.kt Simplifies lifecycle collection to a single observeEntities() job.
wear/src/main/kotlin/io/homeassistant/companion/android/data/SimplifiedEntity.kt Renames friendlyName to name and updates serialization string accordingly.
wear/src/main/kotlin/io/homeassistant/companion/android/complications/views/ComplicationConfigMainView.kt Uses entity?.name for the configured entity display.
wear/src/main/kotlin/io/homeassistant/companion/android/complications/EntityStateDataSourceService.kt Resolves complication entity via display pipeline and uses name + resolved state text.
wear/src/main/kotlin/io/homeassistant/companion/android/complications/ComplicationConfigViewModel.kt Populates entity lists and stored shortcut data from display-resolved entities.
common/src/main/kotlin/io/homeassistant/companion/android/database/wear/ThermostatTile.kt Updates doc comment to “entity name” terminology.
common/src/main/kotlin/io/homeassistant/companion/android/database/wear/FavoriteCaches.kt Renames cached favorite field/column to name with clearer KDoc.
common/src/main/kotlin/io/homeassistant/companion/android/database/migration/DatabaseMigration.kt Adds auto-migration spec to rename favorite_cache.friendly_namename.
common/src/main/kotlin/io/homeassistant/companion/android/database/AppDatabase.kt Bumps Room DB version to 53 and registers the 52→53 auto-migration spec.
common/src/main/kotlin/io/homeassistant/companion/android/common/data/integration/Entity.kt Adds ClimateControls and Entity.getClimateControls() helper.
common/src/main/kotlin/io/homeassistant/companion/android/common/data/integration/display/EntityDisplayState.kt Clarifies awaitLoadedOrNull() KDoc about skipping Loading and returning null on Error.
common/src/main/kotlin/io/homeassistant/companion/android/common/data/integration/display/EntityDisplay.kt Adds climateControls to EntityDisplay* and resolves it in EntityDisplayWithoutContext.
common/schemas/io.homeassistant.companion.android.database.AppDatabase/53.json Adds updated Room schema snapshot for DB version 53.
Comments suppressed due to low confidence (1)

wear/src/main/kotlin/io/homeassistant/companion/android/complications/EntityStateDataSourceService.kt:50

  • Using EntitiesForDisplayManager.snapshot(..., listOf(entityId)) triggers a full getStates() fetch under the hood (via IntegrationRepository.getEntities()), which is heavy for complication updates. A single-entity optimized path would reduce network/battery use.
        val displayEntity = entitiesForDisplayManager.snapshot(ServerManager.SERVER_ID_ACTIVE, listOf(entityId))
            .awaitLoadedOrNull()
            ?.entity(entityId)

Comment on lines 107 to 111
val entity = tileConfig.entityId?.let {
serverManager.integrationRepository().getEntity(it)
entitiesForDisplayManager.snapshot(ServerManager.SERVER_ID_ACTIVE, listOf(it))
.awaitLoadedOrNull()
?.entity(it)
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I don't think such API exists today, the list_for_display returns everything and has no parameters.

@TimoPtr
TimoPtr force-pushed the feature/friendly_state_better_unit_display branch from c889a37 to 7fe52ce Compare July 28, 2026 10:47
@TimoPtr
TimoPtr force-pushed the feature/wear_remove_friendly_name branch from 907d1a5 to bf100cc Compare July 28, 2026 10:47
@TimoPtr
TimoPtr force-pushed the feature/friendly_state_better_unit_display branch from 7fe52ce to 626535d Compare July 28, 2026 12:14
@TimoPtr
TimoPtr force-pushed the feature/wear_remove_friendly_name branch from e5090ba to f744629 Compare July 28, 2026 12:15
Base automatically changed from feature/friendly_state_better_unit_display to main July 28, 2026 12:46
@TimoPtr
TimoPtr force-pushed the feature/wear_remove_friendly_name branch from f744629 to c19ad87 Compare July 28, 2026 12:59

@jpelgrom jpelgrom left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Most code changes make sense, but I want to test with a dummy entities set for tiles tomorrow so no final review yet.

Comment on lines 125 to 128
/**
* Internal thread-safe holder for registry data used for entity classification.
* Wrapped in a [MutableStateFlow] to guarantee visibility and consistency across dispatchers.
*/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Stale comment

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.

Remove usage of friendly name in wear

3 participants