Fix wake_on_lan ping for Linux. (#6480)

This commit is contained in:
siebert authored and Paulus Schoutsen committed 2017-03-07 20:57:35 -08:00
1 parent bb4f23f8e7
commit 2c5d3387f2
1 file changed
+4 -4
@@ -85,11 +85,11 @@ class WOLSwitch(SwitchDevice):
def update(self): def update(self):
"""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 {} {}'.format( ping_cmd = ['ping', '-n', '1', '-w',
DEFAULT_PING_TIMEOUT * 1000, self._host) str(DEFAULT_PING_TIMEOUT * 1000), self._host]
else: else:
ping_cmd = 'ping -c 1 -W {} {}'.format( ping_cmd = ['ping', '-c', '1', '-W',
DEFAULT_PING_TIMEOUT, self._host) str(DEFAULT_PING_TIMEOUT), 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)