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

Only auth on enter_learning in response to errors for broadlink #27341

Merged
merged 5 commits into from Feb 9, 2020

Conversation

@bmfurtado
Copy link
Contributor

bmfurtado commented Oct 8, 2019

Breaking Change:

For a while now, multiple issues (#25943, #27213) have mentioned that learning new IR commands fails on the broadlink integration. I tracked this down to the fact that the auth() method seems to return False for all executions except the very first one (which happens during the switch component setup).

Description:

Related issue (if applicable): fixes #27213

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

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.
  • I have followed the development checklist

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. Update and include derived files by running python3 -m script.hassfest.
  • [] New or updated dependencies have been added to requirements_all.txt by running python3 -m script.gen_requirements_all.
  • [] Untested files have been added to .coveragerc.

If the code does not interact with devices:

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

This comment has been minimized.

Copy link
Contributor

homeassistant commented Oct 8, 2019

Hi @bmfurtado,

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@probot-home-assistant

This comment has been minimized.

Copy link

probot-home-assistant bot commented Oct 8, 2019

Hey there @Danielhiversen, mind taking a look at this pull request as its been labeled with a integration (broadlink) you are listed as a codeowner for? Thanks!

@homeassistant homeassistant added cla-signed and removed cla-needed labels Oct 8, 2019
@bmfurtado bmfurtado marked this pull request as ready for review Oct 8, 2019
@bmfurtado bmfurtado requested a review from Danielhiversen as a code owner Oct 8, 2019
@pvizeli

This comment has been minimized.

Copy link
Member

pvizeli commented Oct 14, 2019

Maybe better to fix on library?

@bmfurtado

This comment has been minimized.

Copy link
Contributor Author

bmfurtado commented Oct 14, 2019

@pvizeli while I understand the argument that maybe the library is what needs to be fixed (it isn't clear to me if the expectation is for auth() to always return True or not since the API is not very strictly documented) but I don't see why the logic during enter_learning should be different from the logic used on send_packet.

I think this both makes the code more consistent (even if slightly more complex) and works around this bug. What do you think?

@orson1282

This comment has been minimized.

Copy link
Contributor

orson1282 commented Oct 18, 2019

Thanks for fixing this @bmfurtado 👍

@MartinHjelmare MartinHjelmare changed the title Only auth on enter_learning in response to errors. Only auth on enter_learning in response to errors for broadlink Oct 31, 2019
@bmfurtado

This comment has been minimized.

Copy link
Contributor Author

bmfurtado commented Dec 4, 2019

@Danielhiversen any thoughts on this PR?

@springstan

This comment has been minimized.

Copy link
Member

springstan commented Feb 2, 2020

@bmfurtado could you please solve the merge conflict and verify locally that this solution still works? Thank you :)

@bmfurtado

This comment has been minimized.

Copy link
Contributor Author

bmfurtado commented Feb 3, 2020

@springstan fixed the conflicts and a minor bug that was leading to a wrong message being logged in failure conditions.

I've tested this in my local setup and it works as expected.

@springstan

This comment has been minimized.

Copy link
Member

springstan commented Feb 4, 2020

@bmfurtado thanks for working on this.

Btw are all of the steps mentioned in #25943 (comment) required for this fix to work?

@bmfurtado

This comment has been minimized.

Copy link
Contributor Author

bmfurtado commented Feb 4, 2020

@springstan to be honest, I don't think so.

I used a clean virtualenv and installed the stuff in requirements-all.txt from homeassistant so the cryptography dependency set there seems to work fine (even though it doesn't match the version required by broadlink-python). My system already had openssl 1.1.1 installed and I didn't do any weird dynamic loading changes or symlink libraries.

I can't be sure in #25943 there wasn't another issue at the same time but it's not all related to the logic I'm fixing here.

Copy link
Member

springstan left a comment

It's a bit of a workaround but I am approving it so this issue can be fixed quickly. @Danielhiversen should take a look as well.

Dev automation moved this from Needs review to Reviewer approved Feb 6, 2020
@balloob balloob merged commit 9f58e5d into home-assistant:dev Feb 9, 2020
9 checks passed
9 checks passed
CI Build #20200203.123 succeeded
Details
CI (FullCheck Mypy) FullCheck Mypy succeeded
Details
CI (FullCheck Pylint) FullCheck Pylint succeeded
Details
CI (Overview CheckFormat) Overview CheckFormat succeeded
Details
CI (Overview Lint) Overview Lint succeeded
Details
CI (Overview Validate) Overview Validate succeeded
Details
CI (Tests PyTest Python37) Tests PyTest Python37 succeeded
Details
codecov/patch Coverage not affected when comparing f5b7900...ba1b7c5
Details
codecov/project 94.62% (target 90%)
Details
Dev automation moved this from Reviewer approved to Done Feb 9, 2020
@lock lock bot locked and limited conversation to collaborators Feb 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Dev
  
Done
Linked issues

Successfully merging this pull request may close these issues.

7 participants
You can’t perform that action at this time.