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 optionalpull/6306/merge
parent
fc46a24996
commit
0aa8933df6
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue