Skip to content

Conversation

piitaya
Copy link
Member

@piitaya piitaya commented Apr 8, 2025

Proposed change

Display entity name, device name, domain and area in the device picker.
When a entity is selected, the label is still the friendly_name. Only row items are changed.
The items are sorting by device name and entity name so the entity are grouped by device.

CleanShot 2025-04-15 at 18 15 30

The entity ID not displayed because it's technical and it should not be needed for most users as more context has been added. However, you can still display it by enabling it with a dedicated setting in the profile.

CleanShot 2025-04-15 at 18 16 18

It will end up with this result : the domain is removed and the entity is displayed in a third line.

CleanShot 2025-04-15 at 18 15 56

Type of change

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

Example configuration

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue or discussion:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

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

@piitaya piitaya added the Needs UX Pull requests requiring a review from the Home Assistant design team label Apr 8, 2025
@piitaya piitaya force-pushed the entity_naming_entity_picker branch from bfd9ca8 to 511e177 Compare April 8, 2025 13:08
@ildar170975

This comment was marked as abuse.

@piitaya piitaya force-pushed the entity_naming_entity_picker branch 2 times, most recently from c27cafe to 76fb3b9 Compare April 14, 2025 09:38
@piitaya piitaya force-pushed the entity_naming_entity_picker branch from 91e03a8 to 3e6455a Compare April 14, 2025 16:00
@frenck frenck added the Noteworthy Marks a PR as noteworthy and should be in the release notes (in case it normally would not appear) label Apr 14, 2025
@piitaya piitaya removed the Needs UX Pull requests requiring a review from the Home Assistant design team label Apr 15, 2025
@piitaya piitaya marked this pull request as ready for review April 16, 2025 14:52
@piitaya piitaya force-pushed the entity_naming_entity_picker branch from 610b67b to 2844ff1 Compare April 16, 2025 18:06
@bramkragten bramkragten self-assigned this Apr 17, 2025
$or: this._fuseKeys.map((key) => ({ [key]: term })),
})),
});
target.filteredItems = results.map((result) => result.item);
Copy link
Member

Choose a reason for hiding this comment

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

So there is no sorting by score, or is that done by fuse internal?

Copy link
Member Author

Choose a reason for hiding this comment

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

Score is always 0. Fuse is unable to sort it as the query contains "or"

@piitaya piitaya force-pushed the entity_naming_entity_picker branch from d5af88c to 393bb51 Compare April 17, 2025 13:23
@piitaya piitaya requested a review from bramkragten April 17, 2025 13:23
@@ -57,6 +57,22 @@ export type HaEntityPickerEntityFilterFunc = (entity: HassEntity) => boolean;

const CREATE_ID = "___create-new-entity___";

const DOMAIN_STYLE = styleMap({
Copy link
Member

Choose a reason for hiding this comment

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

still don't understand why it has to be a styleMap, it is not dynamic?

Copy link
Member Author

@piitaya piitaya Apr 17, 2025

Choose a reason for hiding this comment

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

For maintenance. Having a string make it hard to read and maintain. It's now outside of the component so it will be computed only once

@bramkragten bramkragten merged commit d56c7c4 into dev Apr 17, 2025
15 checks passed
@bramkragten bramkragten deleted the entity_naming_entity_picker branch April 17, 2025 14:43
@piitaya piitaya mentioned this pull request Aug 25, 2025
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed Noteworthy Marks a PR as noteworthy and should be in the release notes (in case it normally would not appear)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants