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

Use skip_configuration flag to skip requests in ZHA #41554

Merged
merged 6 commits into from Oct 17, 2020

Conversation

abmantis
Copy link
Contributor

@abmantis abmantis commented Oct 9, 2020

Proposed change

Some initialization requests were still being made, despite skip_configuration being set for the device. Since devices that have this set to True don't usually reply without being constantly waked up, we can skip some requests to make pairing quicker.
Note: we could add a skip_initialization flag, but I don't think that's really needed atm.

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:
  • 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

To help with the load of incoming pull requests:

The on_off attribute is on the REPORT_CONFIG, so
super().async_initialize already requests it from the device.
No need to request it twice.
@project-bot project-bot bot added this to Needs review in Dev Oct 9, 2020
@abmantis abmantis marked this pull request as draft October 9, 2020 13:41
@abmantis
Copy link
Contributor Author

abmantis commented Oct 9, 2020

Still have to fix imports order.

@abmantis abmantis marked this pull request as ready for review October 9, 2020 18:23
@abmantis
Copy link
Contributor Author

@Adminiuga @dmulcahey Can you take a look please?

Comment on lines 203 to 206
if self._ch_pool.skip_configuration:
self._status = ChannelStatus.INITIALIZED
return

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering if this is going to affect restoration of Xiaomi based sensors values after a restart???

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right. Maybe I should do
if not from_cache and self._ch_pool.skip_configuration:

What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

That should work.

)
if power_source is not None:
self._power_source = power_source
if not self._ch_pool.skip_configuration:
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above

Dev automation moved this from Needs review to Reviewer approved Oct 17, 2020
Copy link
Contributor

@Adminiuga Adminiuga left a comment

Choose a reason for hiding this comment

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

lgtm

@Adminiuga Adminiuga merged commit 28fb761 into home-assistant:dev Oct 17, 2020
Dev automation moved this from Reviewer approved to Done Oct 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Dev
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants