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

Use IP Address (host) provided by mDNS on Elgato Key Light #38539

Merged
merged 4 commits into from Aug 5, 2020

Conversation

pedrolamas
Copy link
Contributor

@pedrolamas pedrolamas commented Aug 4, 2020

Proposed change

On Elgato Key Light integration, take the IP reported by mDNS/Zeroconf, obtain the local domain name, and use that for the rest of the configuration flow (instead of the mDNS name)

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

  • This PR fixes or closes issue: fixes Use host for mDNS on Elgato Key Light discovery integration #38537

  • 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

@probot-home-assistant
Copy link

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

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.

Please update the config entry instead.

Furthermore, some tests are failing that need to be adjusted.

homeassistant/components/elgato/config_flow.py Outdated Show resolved Hide resolved
homeassistant/components/elgato/config_flow.py Outdated Show resolved Hide resolved
@frenck frenck added this to Needs review in Dev via automation Aug 4, 2020
@frenck frenck moved this from Needs review to Review in progress in Dev Aug 4, 2020
@pedrolamas
Copy link
Contributor Author

@frenck I made the changes and tests are now passing, but I was wondering if I should make the call to self.context.update() before the call to _abort_if_unique_id_configured() to make sure the host is updated?

@frenck
Copy link
Member

frenck commented Aug 4, 2020

Nope, the flow context is not related to the unique ID handling.

@pedrolamas pedrolamas marked this pull request as ready for review August 4, 2020 21:52
@pedrolamas
Copy link
Contributor Author

Given that, and unless I'm missing something, I believe this is now complete!

@frenck frenck self-requested a review August 4, 2020 22:38
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.

self._abort_if_unique_id_configured()

Must now update the host in the existing config entry:

self._abort_if_unique_id_configured(updates={CONF_HOST: user_input[CONF_HOST]})

@pedrolamas
Copy link
Contributor Author

Thanks for your patience, @frenck, I think I got it now (python is not my strong)

I also updated the test case to make sure that the host change is reflected in the config entry.

@frenck
Copy link
Member

frenck commented Aug 5, 2020

✅ Nice! One small issue with the formatting left (Black errored on the CI).

@pedrolamas pedrolamas changed the title Use local domain name instead of mDNS name on Elgato Key Light Use IP Address (host) provided by mDNS on Elgato Key Light Aug 5, 2020
@pedrolamas
Copy link
Contributor Author

@frenck that's now also fixed!

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.

Thanks, @pedrolamas 👍

Dev automation moved this from Review in progress to Reviewer approved Aug 5, 2020
@frenck frenck merged commit e422274 into home-assistant:dev Aug 5, 2020
Dev automation moved this from Reviewer approved to Done Aug 5, 2020
@pedrolamas pedrolamas deleted the pedrolamas/elgato-fix branch August 5, 2020 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Dev
  
Done
Development

Successfully merging this pull request may close these issues.

Use host for mDNS on Elgato Key Light discovery integration
3 participants