mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
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
This commit is contained in:
parent
fc46a24996
commit
0aa8933df6
@ -86,10 +86,10 @@ class WOLSwitch(SwitchDevice):
|
|||||||
"""Check if device is on and update the state."""
|
"""Check if device is on and update the state."""
|
||||||
if platform.system().lower() == 'windows':
|
if platform.system().lower() == 'windows':
|
||||||
ping_cmd = ['ping', '-n', '1', '-w',
|
ping_cmd = ['ping', '-n', '1', '-w',
|
||||||
str(DEFAULT_PING_TIMEOUT * 1000), self._host]
|
str(DEFAULT_PING_TIMEOUT * 1000), str(self._host)]
|
||||||
else:
|
else:
|
||||||
ping_cmd = ['ping', '-c', '1', '-W',
|
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)
|
status = sp.call(ping_cmd, stdout=sp.DEVNULL)
|
||||||
self._state = not bool(status)
|
self._state = not bool(status)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user