Skip to content

Commit b4c3de3

Browse files
authored
Fix switch.tplink doing I/O in event bus (home-assistant#5589)
* Fix switch.tplink doing I/O in event bus * Update tplink.py
1 parent b732174 commit b4c3de3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

homeassistant/components/switch/tplink.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def name(self):
6666
@property
6767
def is_on(self):
6868
"""Return true if switch is on."""
69-
return self.smartplug.is_on
69+
return self._state
7070

7171
def turn_on(self, **kwargs):
7272
"""Turn the switch on."""
@@ -84,7 +84,8 @@ def device_state_attributes(self):
8484
def update(self):
8585
"""Update the TP-Link switch's state."""
8686
try:
87-
self._state = self.smartplug.state
87+
self._state = self.smartplug.state == \
88+
self.smartplug.SWITCH_STATE_ON
8889

8990
if self.smartplug.has_emeter:
9091
emeter_readings = self.smartplug.get_emeter_realtime()

0 commit comments

Comments
 (0)