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

Improve stability of homekit accessory ids #35691

Merged

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented May 16, 2020

Breaking change

To solve a stability problem, HomeKit now uses the entity unique id to generate accessory ids when available. This change allows HomeKit to retain accessory settings when integrations change naming formats or after renaming entities. As a result, some accessories may need a one time reset by calling the homekit.reset_accessory service for them to function again.

Version 0.109 introduced persistent storage for HomeKit accessory ids. When upgrading from 0.108 or earlier, it is highly is recommended to upgrade to 0.110 first to allow the system to store the accessory ids and avoid the need to call the homekit.reset_accessory service.

If the upgrade path skips both 0.109 and 0.110, it may be necessary to unpair and repair the HomeKit Bridge.

Proposed change

Accessory ids are now generated from the unique id
by default when available

Previously homekit accessory ids were generated with
adler32 of the entity id by default in order to retain backwards
compatibility. adler32 is subject to frequent collisions and
could cause instability.

As versions 0.109 and 0.110 store the
aid for entities between restarts this change should
only affect entity that were not seen before by homekit.

Type of change

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

Example entry for configuration.yaml:

# Example configuration.yaml

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

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

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

@bdraco bdraco force-pushed the homekit_aid_generation_prefer_unique_id branch from 4ab7d3f to 13f18dd Compare May 16, 2020 03:42
@bdraco bdraco requested a review from Jc2k May 17, 2020 23:30
@bdraco bdraco linked an issue May 18, 2020 that may be closed by this pull request
@bdraco bdraco linked an issue May 20, 2020 that may be closed by this pull request
3 tasks
Accessory ids are now generated from the unique id
by default when available

Previously homekit accessory ids were generated with
adler32 of the entity id by default in order to retain backwards
compatibility. adler32 is subject to frequent collisions and
could cause instability.

As versions 0.109 and 0.110 store the
aid for entities between restarts this change should
only affect entity that were not seen before by homekit.
@bdraco bdraco force-pushed the homekit_aid_generation_prefer_unique_id branch from 13f18dd to f1f5225 Compare May 26, 2020 14:33
@bdraco
Copy link
Member Author

bdraco commented May 26, 2020

rebased to make sure this still works ok with all the other homekit changes that have gone in since this PR was opened.

@balloob balloob merged commit 879e2d1 into home-assistant:dev May 27, 2020
kennedyshead pushed a commit to kennedyshead/home-assistant that referenced this pull request May 28, 2020
@bdraco bdraco mentioned this pull request Oct 8, 2022
23 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants