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

Fix wake_on_lan ping with None as host #6532

Merged
merged 3 commits into from
Mar 12, 2017
Merged

Fix wake_on_lan ping with None as host #6532

merged 3 commits into from
Mar 12, 2017

Conversation

flamechair
Copy link
Contributor

@flamechair flamechair commented Mar 12, 2017

With the new update, wake_on_lan requires a host key in the configuration

Description:

Related issue (if applicable): fixes #

Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#2235

Example entry for configuration.yaml (if applicable):

Checklist:

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • New dependencies have been added to the REQUIREMENTS variable (example).
  • New dependencies are only imported inside functions that use them (example).
  • New dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

If the code does not interact with devices:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • Tests have been added to verify that the new code works.

With the new update, wake_on_lan requires a host key in the configuration
@mention-bot
Copy link

@iamtpage, thanks for your PR! By analyzing the history of the files in this pull request, we identified @balloob, @fabaff and @Chris-V to be potential reviewers.

@homeassistant
Copy link
Contributor

Hi @iamtpage,

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@flamechair flamechair changed the title Update configuration validation Update configuration validation for wake_on_lan Mar 12, 2017
@MartinHjelmare
Copy link
Member

I'm marking this as a breaking change, even though someone else made it break. We need to remember to update the docs, and mention this when released.

@MartinHjelmare
Copy link
Member

Actually, I think we should instead convert self._host to a string on lines 89 and 92.

str(self._host)

@MartinHjelmare MartinHjelmare removed this from the 0.40.1 milestone Mar 12, 2017
@MartinHjelmare
Copy link
Member

Now the question is if we should retain the old behavior where host is optional. I'm thinking we don't need to have it required now since the code will work passing a stringified None to the subprocess call.

@flamechair
Copy link
Contributor Author

Yeah that would make sense, making it required would be considered a breaking change, and casting it to a string wouldn't break anything if it wasn't there.

@MartinHjelmare MartinHjelmare added this to the 0.40.1 milestone Mar 12, 2017
@MartinHjelmare MartinHjelmare changed the title Update configuration validation for wake_on_lan Fix wake_on_lan ping with None as host Mar 12, 2017
@MartinHjelmare
Copy link
Member

Thanks! Updated the PR title to reflect latest changes.

@balloob
Copy link
Member

balloob commented Mar 16, 2017

Cherry-picked for 0.40.1

balloob pushed a commit that referenced this pull request Mar 16, 2017
* Update configuration validation

With the new update, wake_on_lan requires a host key in the configuration

* cast self._host to str as requested

* Changed host key back to optional
@balloob balloob mentioned this pull request Mar 16, 2017
@brianjking
Copy link

I'm confused @balloob. I don't see any updates here or in the referenced PR here.

@flamechair
Copy link
Contributor Author

@brianjking having a host is still optional after this merge, we just changed how it is handled on the backend. So updating documentation is not necessary, and I closed the documentation PR.

@siebert
Copy link
Contributor

siebert commented Mar 17, 2017

Why is the external ping command executed at all if host is None?

@flamechair
Copy link
Contributor Author

Because WOL only needs a Mac address to work, the host entry is to be able to verify if the host is woken up (by pinging it, and with ping you need a host IP to ping)

@siebert
Copy link
Contributor

siebert commented Mar 17, 2017

Yes, WoL needs only a Mac to wake the host, but as you said, for pinging the host you also need the IP. My point is, if host is None (no IP), there is no need to ping at all, so the code should IMHO be changed to skip the execution of the ping command in this case.

@balloob balloob mentioned this pull request Mar 24, 2017
@home-assistant home-assistant locked and limited conversation to collaborators Jun 24, 2017
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.

7 participants