From 0aa8933df675aa3ea93126c0b1eb7c9a77208331 Mon Sep 17 00:00:00 2001 From: Tyler Page Date: Sun, 12 Mar 2017 15:46:58 -0400 Subject: [PATCH] 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 --- homeassistant/components/switch/wake_on_lan.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/switch/wake_on_lan.py b/homeassistant/components/switch/wake_on_lan.py index d9f7d0ad637..ba3439dc951 100644 --- a/homeassistant/components/switch/wake_on_lan.py +++ b/homeassistant/components/switch/wake_on_lan.py @@ -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)