From 21115add55ee3f6faad623eec79620c58fa19d2b Mon Sep 17 00:00:00 2001 From: goto100 Date: Mon, 27 Mar 2017 18:26:14 +0800 Subject: [PATCH 1/2] fix WOL in docker/jail add ip_address parameter to send_magic_packet if host specific. in docker/jail, WOL doesn't works due to subnet broadcast issues. --- homeassistant/components/switch/wake_on_lan.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/switch/wake_on_lan.py b/homeassistant/components/switch/wake_on_lan.py index ba3439dc951d7d..9211786234e4a6 100644 --- a/homeassistant/components/switch/wake_on_lan.py +++ b/homeassistant/components/switch/wake_on_lan.py @@ -75,7 +75,10 @@ def name(self): def turn_on(self): """Turn the device on.""" - self._wol.send_magic_packet(self._mac_address) + if self._host: + self._wol.send_magic_packet(self._mac_address, ip_address=self._host) + else: + self._wol.send_magic_packet(self._mac_address) def turn_off(self): """Turn the device off if an off action is present.""" From 2cfdb366ec1ad6b12ab8ea6f1ada31402d5a04c0 Mon Sep 17 00:00:00 2001 From: goto100 Date: Mon, 27 Mar 2017 18:49:27 +0800 Subject: [PATCH 2/2] Update wake_on_lan.py lint --- homeassistant/components/switch/wake_on_lan.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/switch/wake_on_lan.py b/homeassistant/components/switch/wake_on_lan.py index 9211786234e4a6..c86a4674bb6e67 100644 --- a/homeassistant/components/switch/wake_on_lan.py +++ b/homeassistant/components/switch/wake_on_lan.py @@ -76,7 +76,8 @@ def name(self): def turn_on(self): """Turn the device on.""" if self._host: - self._wol.send_magic_packet(self._mac_address, ip_address=self._host) + self._wol.send_magic_packet(self._mac_address, + ip_address=self._host) else: self._wol.send_magic_packet(self._mac_address)