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

Performance optimization of TP-Link switch #11416

Merged

Conversation

amelchio
Copy link
Contributor

@amelchio amelchio commented Jan 1, 2018

Description:

Setting the LED state (introduced with #10980) on my HS110 takes around a second. With many switches around the house, this adds up to a noticeable delay during each update.

This PR moves the setting from update to setup_platform time so it only happens once.

The PR also changes the default so the LED is left alone if no option is specified. I think that is more reasonable and it completely avoids the slow setting operation for the common case of people not caring about the LED state. I will update the docs if we can agree on this change.

CC: @DanNixon

Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#4327

Checklist:

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

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

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

@DanNixon
Copy link
Contributor

DanNixon commented Jan 1, 2018

Looks good to me.

I think I only included it in update to cover the case of a switch being unreachable when HA starts. But that is such a narrow edge case that it's not worth the extra delay of constantly setting the LED state.

@amelchio
Copy link
Contributor Author

amelchio commented Jan 2, 2018

As we are flooded with PRs I will go ahead and merge this.

@amelchio amelchio merged commit feb70b4 into home-assistant:dev Jan 2, 2018
@balloob balloob mentioned this pull request Jan 11, 2018
@home-assistant home-assistant locked and limited conversation to collaborators May 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants