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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dhcp discovery to smartthings #50306

Merged
merged 2 commits into from May 11, 2021
Merged

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented May 8, 2021

Proposed change

Add dhcp discovery to smartthings

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

  • 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.
  • 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 probot-home-assistant bot added integration: smartthings small-pr PRs with less than 30 lines. labels May 8, 2021
@project-bot project-bot bot added this to Needs review in Dev May 8, 2021
@probot-home-assistant
Copy link

Hey there @andrewsayre, mind taking a look at this pull request as its been labeled with an integration (smartthings) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)

@andrewsayre
Copy link
Member

SmartThings is a cloud integration and can't be setup solely based on discovery of a hub on the network--further a hub isn't even required for this integration to work. Config entries are tied to a SmartThings location (which is a cloud resource not related to a local hub). I'm concerned that the user experience will be poor because a unique ID can't be tied to discovery and therefore won't this keep prompting the user to setup the integration every restart?

@bdraco
Copy link
Member Author

bdraco commented May 8, 2021

SmartThings is a cloud integration and can't be setup solely based on discovery of a hub on the network--further a hub isn't even required for this integration to work. Config entries are tied to a SmartThings location (which is a cloud resource not related to a local hub). I'm concerned that the user experience will be poor because a unique ID can't be tied to discovery and therefore won't this keep prompting the user to setup the integration every restart?

Hi Andrew,

Discovery implements handling this case with _async_handle_discovery_without_unique_id https://github.com/home-assistant/core/blob/dev/homeassistant/config_entries.py#L1214

If the user already has a smartthings config entry, they won't see another one pop up (https://github.com/home-assistant/core/blob/dev/homeassistant/config_entries.py#L1227)

If they ignore it, it won't come back again either (https://github.com/home-assistant/core/blob/dev/homeassistant/config_entries.py#L1232)

This is a relatively common pattern for cloud devices

https://github.com/home-assistant/core/blob/dev/homeassistant/components/blink/manifest.json
https://github.com/home-assistant/core/blob/dev/homeassistant/components/flume/manifest.json
https://github.com/home-assistant/core/blob/dev/homeassistant/components/sense/manifest.json
https://github.com/home-assistant/core/blob/dev/homeassistant/components/tesla/manifest.json
https://github.com/home-assistant/core/blob/dev/homeassistant/components/tuya/manifest.json

@iridris
Copy link
Contributor

iridris commented May 9, 2021

I don't think this captures all possible MAC addresses for SmartThings hubs. I have a hubv2 with a totally different MAC prefix: d0:52:a8:.

@bdraco
Copy link
Member Author

bdraco commented May 9, 2021

I don't think this captures all possible MAC addresses for SmartThings hubs. I have a hubv2 with a totally different MAC prefix: d0:52:a8:.

Thanks. These lists tend to grow over time as we discover more combinations.

Which hostname does your hub request via dhcp?

If you don't know, turn on debug logging for homeassistant.components.dhcp and restart the hub while watching the log.

@iridris
Copy link
Contributor

iridris commented May 9, 2021

I don't think this captures all possible MAC addresses for SmartThings hubs. I have a hubv2 with a totally different MAC prefix: d0:52:a8:.

Thanks. These lists tend to grow over time as we discover more combinations.

Which hostname does your hub request via dhcp?

If you don't know, turn on debug logging for homeassistant.components.dhcp and restart the hub while watching the log.

DHCP hostname shows up as: hubv2-d052a826652b0001. The first half of the hub's MAC is included in the hostname (d052a8) but the rest of the hostname does not match the rest of the MAC, so I'm not sure what the rest of the hostname is generated from.

@bdraco
Copy link
Member Author

bdraco commented May 9, 2021

I don't think this captures all possible MAC addresses for SmartThings hubs. I have a hubv2 with a totally different MAC prefix: d0:52:a8:.

Thanks. These lists tend to grow over time as we discover more combinations.
Which hostname does your hub request via dhcp?
If you don't know, turn on debug logging for homeassistant.components.dhcp and restart the hub while watching the log.

DHCP hostname shows up as: hubv2-d052a826652b0001. The first half of the hub's MAC is included in the hostname (d052a8) but the rest of the hostname does not match the rest of the MAC, so I'm not sure what the rest of the hostname is generated from.

That OUI is registered to Physical Graph Corp which seems to be owned by Smart Things https://blog.smartthings.com/iot101/introducing-the-physical-graph/

@bdraco
Copy link
Member Author

bdraco commented May 9, 2021

Thanks @iridris. I went ahead and added that OUI

Dev automation moved this from Needs review to Reviewer approved May 11, 2021
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.

This looks good and follows the recent strategy we are taking on this.

Thanks, @bdraco 馃憤

@frenck frenck merged commit 3b272ec into home-assistant:dev May 11, 2021
Dev automation moved this from Reviewer approved to Done May 11, 2021
@github-actions github-actions bot locked and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
Dev
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

5 participants