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

Exclude disabled entities from device class lookup #38527

Closed
wants to merge 1 commit into from

Conversation

chrisaljoudi
Copy link
Contributor

@chrisaljoudi chrisaljoudi commented Aug 4, 2020

Proposed change

async_get_device_class_lookup shouldn't include disabled entities in the returned lookup table.

This resolves an issue where HomeKit Bridge takes those disabled entities into consideration when determining the characteristics to expose to HomeKit.

For example, if a user disabled the battery sensor entity for a thermostat device (for example, because it's wired), async_get_device_class_lookup would still include that in the returned lookup table, subsequently causing HomeKit bridge to utilize that entity and advertise it to HomeKit even though it's disabled, in turn causing many warnings when the state turns out to be missing:

screenshot of warning from HomeKit Bridge, showing climate.pool_area: Battery sensor state missing: None

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

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

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

This resolves an issue where HomeKit Bridge takes those disabled entities into consideration when determining the characteristics to expose to HomeKit
@probot-home-assistant probot-home-assistant bot added bugfix core small-pr PRs with less than 30 lines. labels Aug 4, 2020
@chrisaljoudi chrisaljoudi changed the title Exclude disabled entities from device class lookup (fixes disabled entities advertised HomeKit) Exclude disabled entities from device class lookup (fixes disabled entities being included in HomeKit accessories) Aug 4, 2020
Copy link
Member

@Jc2k Jc2k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you update the tests for this helper to include a test case for this change? The existing test is here.

Would also be good if you could add tests to homekit as well. We could do with making sure there are tests there for when the primary entity is disabled (if there aren't already) as well as when as the secondary "linked" entities like batteries you mention are disabled (which there presumably arent yet).

@MartinHjelmare MartinHjelmare changed the title Exclude disabled entities from device class lookup (fixes disabled entities being included in HomeKit accessories) Exclude disabled entities from device class lookup Aug 16, 2020
@bdraco
Copy link
Member

bdraco commented Sep 7, 2020

This is a good change, but as Jc2k points out, it needs tests.

@stale
Copy link

stale bot commented Oct 12, 2020

There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days.
Thank you for your contributions.

@stale stale bot added the stale label Oct 12, 2020
@frenck
Copy link
Member

frenck commented Nov 8, 2020

Closing this PR as stale. Feel free to re-open when ready to work on it again.

@frenck frenck closed this Nov 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants