From 8edac48166b4844c13ec47c231bb14b963e6f558 Mon Sep 17 00:00:00 2001 From: Tyler Page Date: Sat, 11 Mar 2017 20:18:48 -0500 Subject: [PATCH 1/3] Update configuration validation With the new update, wake_on_lan requires a host key in the configuration --- homeassistant/components/switch/wake_on_lan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/switch/wake_on_lan.py b/homeassistant/components/switch/wake_on_lan.py index d9f7d0ad637033..2859f641c7507e 100644 --- a/homeassistant/components/switch/wake_on_lan.py +++ b/homeassistant/components/switch/wake_on_lan.py @@ -27,7 +27,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_MAC_ADDRESS): cv.string, - vol.Optional(CONF_HOST): cv.string, + vol.Required(CONF_HOST): cv.string, vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string, vol.Optional(CONF_OFF_ACTION): cv.SCRIPT_SCHEMA, }) From 608641b0d9a6c651a4756cf7a27756b531aa2b51 Mon Sep 17 00:00:00 2001 From: Tyler Page Date: Sun, 12 Mar 2017 12:12:01 -0400 Subject: [PATCH 2/3] cast self._host to str as requested --- 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 2859f641c7507e..3db484f7e1212c 100644 --- a/homeassistant/components/switch/wake_on_lan.py +++ b/homeassistant/components/switch/wake_on_lan.py @@ -86,10 +86,10 @@ def update(self): """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) From 82ceb11d6e23ac8043b9132a6281e26f7bd97918 Mon Sep 17 00:00:00 2001 From: Tyler Page Date: Sun, 12 Mar 2017 15:22:56 -0400 Subject: [PATCH 3/3] Changed host key back to optional --- homeassistant/components/switch/wake_on_lan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/switch/wake_on_lan.py b/homeassistant/components/switch/wake_on_lan.py index 3db484f7e1212c..ba3439dc951d7d 100644 --- a/homeassistant/components/switch/wake_on_lan.py +++ b/homeassistant/components/switch/wake_on_lan.py @@ -27,7 +27,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_MAC_ADDRESS): cv.string, - vol.Required(CONF_HOST): cv.string, + vol.Optional(CONF_HOST): cv.string, vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string, vol.Optional(CONF_OFF_ACTION): cv.SCRIPT_SCHEMA, })