From b4c3de321577ce7276331e20812b4f12f4555690 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Fri, 27 Jan 2017 22:45:57 -0800 Subject: [PATCH] Fix switch.tplink doing I/O in event bus (#5589) * Fix switch.tplink doing I/O in event bus * Update tplink.py --- homeassistant/components/switch/tplink.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/switch/tplink.py b/homeassistant/components/switch/tplink.py index 2457e49f955..961ee72496e 100644 --- a/homeassistant/components/switch/tplink.py +++ b/homeassistant/components/switch/tplink.py @@ -66,7 +66,7 @@ class SmartPlugSwitch(SwitchDevice): @property def is_on(self): """Return true if switch is on.""" - return self.smartplug.is_on + return self._state def turn_on(self, **kwargs): """Turn the switch on.""" @@ -84,7 +84,8 @@ class SmartPlugSwitch(SwitchDevice): def update(self): """Update the TP-Link switch's state.""" try: - self._state = self.smartplug.state + self._state = self.smartplug.state == \ + self.smartplug.SWITCH_STATE_ON if self.smartplug.has_emeter: emeter_readings = self.smartplug.get_emeter_realtime()