mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 06:17:07 +00:00
Fix wake_on_lan ping for Linux. (#6480)
This commit is contained in:
parent
bb4f23f8e7
commit
2c5d3387f2
@ -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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user