FutureTense / keymaster

Home Assistant integration for managing Z-Wave enabled locks
MIT License
238 stars 45 forks source link

fix: add unique_id to template yaml entities #368

Closed Omnipius closed 6 months ago

Omnipius commented 6 months ago

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

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 commented 6 months ago

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

Omnipius commented 6 months ago

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.