Skip to content

Improve stripPrefixFromEntityName to handle colon and space separator#11691

Merged
bramkragten merged 1 commit intohome-assistant:devfrom
bdr99:strip-prefix-colon
Feb 15, 2022
Merged

Improve stripPrefixFromEntityName to handle colon and space separator#11691
bramkragten merged 1 commit intohome-assistant:devfrom
bdr99:strip-prefix-colon

Conversation

@bdr99
Copy link
Copy Markdown
Contributor

@bdr99 bdr99 commented Feb 15, 2022

Proposed change

I noticed that the Z-Wave JS integration (and possibly others) uses a colon and a space to separate device names from entity names. This causes the stripPrefixFromEntityName logic to fail because it is expecting just a space. This has the undesired effect of the full entity names being shown on the device page:

Screenshot 2022-02-04 203916

This PR expands stripPrefixFromEntityName to strip the prefix regardless of whether it is separated by a space, or a colon and a space. This improves the UX by shortening the displayed entity names:

image

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:

@bramkragten bramkragten enabled auto-merge (squash) February 15, 2022 08:54
@bramkragten bramkragten merged commit d049990 into home-assistant:dev Feb 15, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Feb 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants