Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add unique_id to template yaml entities #368

Merged
merged 1 commit into from
May 22, 2024

Conversation

Omnipius
Copy link
Contributor

Breaking change

If you have manually given any keymaster entities a unique_id in the keymaster yaml templates or generated yaml packages, this update will break after you regenerate the packages. If you have made any modifications to keymaster yaml, it is recommended to fully remove the keymaster integration and any manually altered entities before installing this update.

Proposed change

Assign each entity which uses the template platform a unique_id matching it's entity_id. This will allow users to hide these entities from the Home Assistant default UI.

Type of change

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

Additional information

This impacts binary_sensor, sensor, and lock domains.

Using entity_id as unique_id is designated as the id source of last resort in the HA developer documentation. However, since keymaster already assumes entity_id to be unique within the given HA instance, the impact of this is negligible.

Generating UUIDs on demand was considered and experimentally implemented. However, the need to maintain a separate registry of UUIDs led to too many edge cases. The proposed solution was selected for its simplicity and stability.

When combined with the additional search and filtering features of HA 2024.4, this makes it possible to hide all keymaster entities for a given lock by searching for your LOCKNAME in the entities list, selecting all, and then selecting hide. If LOCKNAME is not unique to keymaster, entities which share that string will need to be filtered out by the user.

The need for unique LOCKNAME strings could be addressed by prefixing all keymaster entities with "keymaster_". However, that would be a breaking change for all users and is therefore omitted in this PR.

@firstof9
Copy link
Collaborator

You've verified these changes work as intended in your local instance?

@Omnipius
Copy link
Contributor Author

You've verified these changes work as intended in your local instance?

Yes. These changes have been applied to my local instance and have been tested to work as intended.

@firstof9 firstof9 changed the title Add unique_id to template yaml entities fix: add unique_id to template yaml entities May 22, 2024
@firstof9 firstof9 added the enhancement New feature or request label May 22, 2024
@firstof9 firstof9 merged commit 8be2470 into FutureTense:main May 22, 2024
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants