From 2c5d3387f23eaff6a689aad46b7b117f3a54bed1 Mon Sep 17 00:00:00 2001 From: siebert Date: Wed, 8 Mar 2017 05:57:35 +0100 Subject: [PATCH] Fix wake_on_lan ping for Linux. (#6480) --- homeassistant/components/switch/wake_on_lan.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/switch/wake_on_lan.py b/homeassistant/components/switch/wake_on_lan.py index 57ad4d34f1a..d9f7d0ad637 100644 --- a/homeassistant/components/switch/wake_on_lan.py +++ b/homeassistant/components/switch/wake_on_lan.py @@ -85,11 +85,11 @@ class WOLSwitch(SwitchDevice): def update(self): """Check if device is on and update the state.""" if platform.system().lower() == 'windows': - ping_cmd = 'ping -n 1 -w {} {}'.format( - DEFAULT_PING_TIMEOUT * 1000, self._host) + ping_cmd = ['ping', '-n', '1', '-w', + str(DEFAULT_PING_TIMEOUT * 1000), self._host] else: - ping_cmd = 'ping -c 1 -W {} {}'.format( - DEFAULT_PING_TIMEOUT, self._host) + ping_cmd = ['ping', '-c', '1', '-W', + str(DEFAULT_PING_TIMEOUT), self._host] status = sp.call(ping_cmd, stdout=sp.DEVNULL) self._state = not bool(status)