Update wink.py (#3957)

* Update wink.py

added lambda and smoke detector call in component loading routine to fix broken functionality.

* Update wink.py

fixed extra space.

* Update wink.py

applied cleaner refactor per comments

* Update wink.py

fixed spacing

* Update wink.py

fixed lint error #1
This commit is contained in:
jbags81 2016-10-22 16:59:20 -04:00 committed by GitHub
parent 678f30def1
commit fb352c20d9

View file

@ -49,6 +49,10 @@ CONFIG_SCHEMA = vol.Schema({
})
}, extra=vol.ALLOW_EXTRA)
WINK_COMPONENTS = [
'binary_sensor', 'sensor', 'light', 'switch', 'lock', 'cover'
]
def setup(hass, config):
"""Setup the Wink component."""
@ -78,19 +82,8 @@ def setup(hass, config):
SUBSCRIPTION_HANDLER.set_heartbeat(120)
# Load components for the devices in Wink that we support
for component_name, func_exists in (
('light', pywink.get_bulbs),
('switch', lambda: pywink.get_switches or pywink.get_sirens or
pywink.get_powerstrip_outlets),
('binary_sensor', pywink.get_sensors),
('sensor', lambda: pywink.get_sensors or pywink.get_eggtrays),
('lock', pywink.get_locks),
('cover', pywink.get_shades),
('cover', pywink.get_garage_doors)):
if func_exists():
discovery.load_platform(hass, component_name, DOMAIN, {}, config)
for component in WINK_COMPONENTS:
discovery.load_platform(hass, component, DOMAIN, {}, config)
return True