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 homekit_controller non-standard hk characteristics #20824

Merged
merged 1 commit into from Feb 8, 2019

Conversation

Projects
None yet
5 participants
@Jc2k
Copy link
Contributor

Jc2k commented Feb 7, 2019

Description:

In the latest HA I normalize the type field of a given characteristic (as annoyingly some present the short form and some present the long form). Unfortunately this breaks for non-Apple characteristics that aren't in the HAP spec.

This fixes the regression by ignoring characteristics that aren't known.

Related issue (if applicable): fixes #20800

Pull request in home-assistant.io with documentation (if applicable): home-assistant/home-assistant.io#<home-assistant.io PR number goes here>

Example entry for configuration.yaml (if applicable):

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.

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

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

  • New dependencies have been added to the REQUIREMENTS variable (example).
  • New dependencies are only imported inside functions that use them (example).
  • New or updated dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

@Jc2k Jc2k force-pushed the Jc2k:homekit-fix-20800 branch from d5c546c to fbb6a60 Feb 7, 2019

@MartinHjelmare MartinHjelmare changed the title Fix #20800 (regression). Ignore non-standard hk characteristics. Fix homekit_controller non-standard hk characteristics Feb 8, 2019

uuid = CharacteristicsTypes.get_uuid(char['type'])
try:
uuid = CharacteristicsTypes.get_uuid(char['type'])
except KeyError:

This comment has been minimized.

@MartinHjelmare

MartinHjelmare Feb 8, 2019

Member

Should we handle it here or in the library?

This comment has been minimized.

@Jc2k

Jc2k Feb 8, 2019

Author Contributor

Good question! I feel like this is multiple questions in one too!

Should the library return unknown characteristics? Probably. If you worked out how to use the characteristic you would be able to drive it with the API's we have.

Should the library normalize the characteristics itself? Yeah, probably. I think it doesn't just because these fragments can be pulled directly from the JSON the device itself is returning, so no one has ever thought to normalize things, they are just passed on as is. I've put that ony my list to discuss with the maintainer.

Should CharacteristicsTypes raise a KeyError in this case? I think so, though we can get rid of it if the API tries to normalize uuid for us.

I think the hotfix should land as-is in the meantime, it will take a while to sort this out upstream if maintainer agrees.

@MartinHjelmare

This comment has been minimized.

Copy link
Member

MartinHjelmare commented Feb 8, 2019

Should we tag it for 0.87.1?

@MartinHjelmare MartinHjelmare merged commit ee3631e into home-assistant:dev Feb 8, 2019

5 checks passed

Hound No violations found. Woof!
WIP Legacy commit status override — see details
Details
cla-bot Everyone involved has signed the CLA
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage decreased (-0.004%) to 93.349%
Details

@wafflebot wafflebot bot removed the in progress label Feb 8, 2019

@Jc2k

This comment has been minimized.

Copy link
Contributor Author

Jc2k commented Feb 8, 2019

@MartinHjelmare if it could be tagged for 0.87.1 that would be amazing!

@MartinHjelmare MartinHjelmare added this to the 0.87.1 milestone Feb 8, 2019

balloob added a commit that referenced this pull request Feb 10, 2019

@balloob balloob referenced this pull request Feb 10, 2019

Merged

0.87.1 #20930

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment