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

Support Huawei LTE SSDP discovery #28214

Merged
merged 11 commits into from
Nov 4, 2019
Merged

Support Huawei LTE SSDP discovery #28214

merged 11 commits into from
Nov 4, 2019

Conversation

scop
Copy link
Member

@scop scop commented Oct 25, 2019

Description:

Per subject.

Related issue (if applicable): fixes #

Pull request with documentation for home-assistant.io (if applicable): home-assistant/home-assistant.io#10992

Example entry for configuration.yaml (if applicable):

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.

# Try to distinguish from other non-LTE Huawei router devices
if (
discovery_info.get(ATTR_UPNP_DEVICE_TYPE)
!= "urn:schemas-upnp-org:device:InternetGatewayDevice:1"
Copy link
Member

Choose a reason for hiding this comment

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

You should be able to add device type to the manifest https://developers.home-assistant.io/docs/en/creating_integration_manifest.html#ssdp

Copy link
Member Author

@scop scop Oct 26, 2019

Choose a reason for hiding this comment

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

The docs say that discovery is invoked if any of the specified info is found. I read that to mean that if I added device type to the manifest, I'd need to check both manufacturer and device type matches in the code (because I would be handed all cases where either of them matches), whereas I now only have to check device type there and manufacturer is taken care of for me. So adding device type to the manifest would just add complexity for no gain that I can see.

Now, if the info match in manifest data would require all specified bits to match (instead of any), then I could move this to the manifest.

Copy link
Member Author

Choose a reason for hiding this comment

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

Verified the "any" behavior, so I guess it's a matter of taste whether to check manufacturer or device type in manifest and the other in code. Leaving as is for now.

Copy link
Member

Choose a reason for hiding this comment

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

oh, interesting. That feels weird 🤔 Wonder if we should update the way it works? I don't think that we have any integrations relying on the any behavior

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree and would be better. Added that and some other improvements in #28285

scop and others added 3 commits October 26, 2019 11:15
@scop scop mentioned this pull request Oct 28, 2019
9 tasks
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.

Looks good!

@MartinHjelmare
Copy link
Member

Test failure is unrelated.

@MartinHjelmare
Copy link
Member

Do we need a new test for the discovery flow entry point to keep coverage?

@scop scop merged commit 6a7b565 into home-assistant:dev Nov 4, 2019
@scop scop deleted the huawei-lte-ssdp branch November 4, 2019 17:57
@lock lock bot locked and limited conversation to collaborators Nov 5, 2019
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