From fb352c20d9205778830196597c968eda495dbac4 Mon Sep 17 00:00:00 2001 From: jbags81 Date: Sat, 22 Oct 2016 16:59:20 -0400 Subject: [PATCH] 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 --- homeassistant/components/wink.py | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/homeassistant/components/wink.py b/homeassistant/components/wink.py index 2e5e7ebcfb4..22c6c992838 100644 --- a/homeassistant/components/wink.py +++ b/homeassistant/components/wink.py @@ -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