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

Netgear try all ports #64170

Merged
merged 8 commits into from
Jan 18, 2022
Merged

Conversation

starkillerOG
Copy link
Contributor

@starkillerOG starkillerOG commented Jan 15, 2022

Proposed change

During config_flow and setup, try all known Netgear ports (5555 and 433 with SSL and 5000 and 80 without SSL).
The port and SSL option given in the config_entry will be the first one that will be attempted, if that fails the other 3 will be tried, if all fail ConfigEntryNotReady will be raised.

On a succesfull connection, the port and SSL will be updated in the config_entry (if they have changed).

This process was recomended by the director of software engineering from Netgear.
According to him that schould work with all Netgear routers and across firmware upgrades.

Motivation for this change is that on the most recent firmware of the popular Netgear R7000 router the port has changed from 5000 to 5555, this has already been fixed for this specific model in PR #64012, but this will ensure a more future proof method that will work for all models.

Also bumps pynetgear version to 0.9.0:
MatMaul/pynetgear@0.8.0...0.9.0

  • improve login method
  • Improve log messages regarding re-login attempts
  • disable InsecureRequestWarning
  • add login_try_port

NOTE: PYNETGEAR VERSION 0.9.0 STILL NEEDS TO BE UPLOADED TO PYPI
I (StarkillerOG) still need to get acces rights from eather @MatMaul or @balloob see MatMaul/pynetgear#90 (comment)

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

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.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • 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:

@probot-home-assistant
Copy link

Hey there @hacf-fr, @Quentame, mind taking a look at this pull request as it has been labeled with an integration (netgear) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

Copy link
Member

@bdraco bdraco left a comment

Choose a reason for hiding this comment

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

Please check the CI.

@balloob
Copy link
Member

balloob commented Jan 17, 2022

If we're going to try it all, we should just stop asking port.

@balloob
Copy link
Member

balloob commented Jan 17, 2022

Also order the ports in the order defaults on newer models -> older models, then configured other ports (SSL etc) on newer models -> older models.

@starkillerOG
Copy link
Contributor Author

Also order the ports in the order defaults on newer models -> older models, then configured other ports (SSL etc) on newer models -> older models.

Actually the director of software engineering from Netgear recommended me to first try the SSL ports and then the ports withouth SSL.
Although I think it does not really matter in which order you do it.

@starkillerOG
Copy link
Contributor Author

@balloob could you give me permission on pypi to upload to the pynetgear project?
(You are a maintainer and @MatMaul already agreed that I schould have acces to pypi see MatMaul/pynetgear#90 (comment))

@starkillerOG
Copy link
Contributor Author

If we're going to try it all, we should just stop asking port.

Done

@MatMaul
Copy link
Contributor

MatMaul commented Jan 17, 2022

@starkillerOG I am in pypi to do so, what's your handle please ?

@starkillerOG
Copy link
Contributor Author

@starkillerOG I am in pypi to do so, what's your handle please ?

My user name is StarkillerOG, what do you mean with handle?

@starkillerOG
Copy link
Contributor Author

@MatMaul this is my profile page: https://pypi.org/user/StarkillerOG/

@starkillerOG
Copy link
Contributor Author

@MatMaul this is my profile page: https://pypi.org/user/StarkillerOG/

Thank you so much @MatMaul, I just uploaded the new 0.9.0 release to pypi

@starkillerOG
Copy link
Contributor Author

@bdraco @balloob This is ready for another review/merge.
All tests pass, I have tested locally and the new pynetgear lib v0.9.0 has been uploaded to pypi.

@balloob balloob merged commit 37caa22 into home-assistant:dev Jan 18, 2022
Copy link
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

Please address the comments in a new PR. Thanks!

homeassistant/components/netgear/__init__.py Show resolved Hide resolved
homeassistant/components/netgear/__init__.py Show resolved Hide resolved
@github-actions github-actions bot locked and limited conversation to collaborators Jan 20, 2022
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.

6 participants