Skip to content

Commit

Permalink
Performance optimization of TP-Link switch (#11416)
Browse files Browse the repository at this point in the history
  • Loading branch information
amelchio committed Jan 2, 2018
1 parent 909f613 commit feb70b4
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions homeassistant/components/switch/tplink.py
Expand Up @@ -24,12 +24,11 @@
CONF_LEDS = 'enable_leds'

DEFAULT_NAME = 'TP-Link Switch'
DEFAULT_LEDS = True

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_HOST): cv.string,
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
vol.Optional(CONF_LEDS, default=DEFAULT_LEDS): cv.boolean,
vol.Optional(CONF_LEDS): cv.boolean,
})


Expand All @@ -51,7 +50,8 @@ def __init__(self, smartplug, name, leds_on):
"""Initialize the switch."""
self.smartplug = smartplug
self._name = name
self._leds_on = leds_on
if leds_on is not None:
self.smartplug.led = leds_on
self._state = None
self._available = True
# Set up emeter cache
Expand Down Expand Up @@ -96,8 +96,6 @@ def update(self):
if self._name is None:
self._name = self.smartplug.alias

self.smartplug.led = self._leds_on

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

Expand Down

0 comments on commit feb70b4

Please sign in to comment.