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

Huawei LTE SSDP improvements #81643

Merged
merged 8 commits into from
Dec 14, 2022
Merged

Huawei LTE SSDP improvements #81643

merged 8 commits into from
Dec 14, 2022

Conversation

scop
Copy link
Member

@scop scop commented Nov 6, 2022

Proposed change

Various fixes and improvements to Huawei LTE SSDP discovery, see individual commits for details.

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)
  • Deprecation (breaking change to happen in the future)
  • 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.
  • 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.

To help with the load of incoming pull requests:

@home-assistant
Copy link

home-assistant bot commented Nov 6, 2022

Hey there @fphammerle, mind taking a look at this pull request as it has been labeled with an integration (huawei_lte) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of huawei_lte can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Change the title of the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign huawei_lte Removes the current integration label and assignees on the issue, add the integration domain after the command.

Copy link
Member

@rytilahti rytilahti left a comment

Choose a reason for hiding this comment

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

Looks straightforward to me, I'm just wondering how often a device with IGD:1 from one of those two manufacturers is not a wanted device? I.e., how useful is it to perform extra checks considering this introduces a new whitelist to maintain.

edit: I'm wondering if the routers do expose some more specific service that could be used for detection?

Copy link
Member

@frenck frenck left a comment

Choose a reason for hiding this comment

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

Good question above ☝️

Otherwise it looks good 👍

@scop
Copy link
Member Author

scop commented Dec 6, 2022

Good questions indeed.

Re the wantedness/allowlist: To be honest, I have no clue, and I have no access to devices we would not want. There used to be the huawei_router integration that dealt with some other than mobile/LTE devices, so I suppose we might encounter some. Anyway, I would be fine with just starting from a clean slate and dropping the current list, and seeing if we get any reports. (Aside, it's not a new whitelist -- one existed already, but was simpler.) I'm kind of indifferent here, if any of you is leaning towards keeping/removing, let's do that, just let me know.

Re the services: the semi-recent device I can access at the moment exposes LANDevice:1, WANPPPConnection:1, WANConnectionDevice:1, WANDevice:1, and InternetGatewayDevice:1. None of those sounds any better or specific than the IGD we currently use, but if anyone knows better or has different opinions, do speak up.

@scop
Copy link
Member Author

scop commented Dec 6, 2022

Another older dongle has services WANIPConnection:1, WANConnectionDevice:1, WANCommonInterfaceConfig:1, WANDevice:1, Layer3Forwarding:1, InternetGatewayDevice:1. Its friendly name is not something that we would have found as "ours" before or after the changes in 4bd2e28 (it's just "Huawei Internet Gateway Device"). Dropping the additional match would make that one discoverable via SSDP.

Guess we could replace the friendlyname match with a probe at an endpoint that according to our best guess is known to be available without authentication in ~all devices if we're worried about false positives. If you have a better feeling about this approach than just removing the match, let me know and I'll have a look at that.

Some older supported dongles have that.
Copy link
Member

@rytilahti rytilahti left a comment

Choose a reason for hiding this comment

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

I think it is good as it is. After all, any potential false positives are a non-issue as the user can likely judge better and in the worst case just ignore the discovered device to stop showing it.

edit: re-reading your second comment, maybe "Huawei" should be added to the regexp to let that another dongle be discovered, too?

@scop
Copy link
Member Author

scop commented Dec 7, 2022

maybe "Huawei" should be added to the regexp to let that another dongle be discovered, too?

To me the regexp exists to filter out other Huawei(/SoyeaLink) devices besides the LTE'y ones, and adding "Huawei" there would more or less defeat the purpose. In that sense I would not add it, but then again, as said, I would be open to removing the regexp match altogether and see where that takes us. As you noted, the worst case scenario wouldn't be that much of a biggie, the user has the option to ignore false positives.

@scop
Copy link
Member Author

scop commented Dec 7, 2022

Found a thinko with regards to unique id handling, addressed in c431a1f.

@rytilahti
Copy link
Member

Ahh, gotcha. Your call, both options are fine in my opinion.

This is fragile at best, and actually prevents some devices from being
considered. Leave it to the user to decide instead.
@scop
Copy link
Member Author

scop commented Dec 14, 2022

I'm leaning towards removing it, done so in f12e378. Going to merge this ~tomorrow unless there are objections.

Copy link
Member

@rytilahti rytilahti left a comment

Choose a reason for hiding this comment

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

I find it also better so, and we can always reconsider in case this will cause too many false positives. Thanks @scop 👍

@rytilahti rytilahti merged commit f02b6f1 into dev Dec 14, 2022
@rytilahti rytilahti deleted the scop-huawei-lte-ssdp-improvements branch December 14, 2022 22:48
@github-actions github-actions bot locked and limited conversation to collaborators Dec 15, 2022
CONF_URL: url,
}
)
return await self._async_show_user_form()
Copy link
Member

Choose a reason for hiding this comment

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

Side note: We should not move directly to another step's form. The form is private to the step method. Await the step method to move to that step.

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.

4 participants