From b8c1bc9542130ee2133ab555a8537d1fe9c88b7e Mon Sep 17 00:00:00 2001 From: goto100 Date: Mon, 27 Mar 2017 20:02:43 +0800 Subject: [PATCH] fix WOL in docker/jail (#6810) * 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. * Update wake_on_lan.py lint --- homeassistant/components/switch/wake_on_lan.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/switch/wake_on_lan.py b/homeassistant/components/switch/wake_on_lan.py index ba3439dc951..c86a4674bb6 100644 --- a/homeassistant/components/switch/wake_on_lan.py +++ b/homeassistant/components/switch/wake_on_lan.py @@ -75,7 +75,11 @@ class WOLSwitch(SwitchDevice): 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."""