Fix wake_on_lan ping with None as host (#6532)

* 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
pull/6306/merge
Tyler Page 2017-03-12 15:46:58 -04:00 committed by Martin Hjelmare
parent fc46a24996
commit 0aa8933df6
1 changed files with 2 additions and 2 deletions

View File

@ -86,10 +86,10 @@ class WOLSwitch(SwitchDevice):
"""Check if device is on and update the state."""
if platform.system().lower() == 'windows':
ping_cmd = ['ping', '-n', '1', '-w',
str(DEFAULT_PING_TIMEOUT * 1000), self._host]
str(DEFAULT_PING_TIMEOUT * 1000), str(self._host)]
else:
ping_cmd = ['ping', '-c', '1', '-W',
str(DEFAULT_PING_TIMEOUT), self._host]
str(DEFAULT_PING_TIMEOUT), str(self._host)]
status = sp.call(ping_cmd, stdout=sp.DEVNULL)
self._state = not bool(status)