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:
parent
678f30def1
commit
fb352c20d9
1 changed files with 6 additions and 13 deletions
|
@ -49,6 +49,10 @@ CONFIG_SCHEMA = vol.Schema({
|
||||||
})
|
})
|
||||||
}, extra=vol.ALLOW_EXTRA)
|
}, extra=vol.ALLOW_EXTRA)
|
||||||
|
|
||||||
|
WINK_COMPONENTS = [
|
||||||
|
'binary_sensor', 'sensor', 'light', 'switch', 'lock', 'cover'
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
def setup(hass, config):
|
def setup(hass, config):
|
||||||
"""Setup the Wink component."""
|
"""Setup the Wink component."""
|
||||||
|
@ -78,19 +82,8 @@ def setup(hass, config):
|
||||||
SUBSCRIPTION_HANDLER.set_heartbeat(120)
|
SUBSCRIPTION_HANDLER.set_heartbeat(120)
|
||||||
|
|
||||||
# Load components for the devices in Wink that we support
|
# Load components for the devices in Wink that we support
|
||||||
for component_name, func_exists in (
|
for component in WINK_COMPONENTS:
|
||||||
('light', pywink.get_bulbs),
|
discovery.load_platform(hass, component, DOMAIN, {}, config)
|
||||||
('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)
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue