Bugfixes to make Wink component work

This commit is contained in:
Paulus Schoutsen 2015-01-11 14:21:44 -08:00
parent 6cd53f2ddf
commit 9db1f3f8b7
3 changed files with 8 additions and 4 deletions

View File

@ -37,8 +37,10 @@ def listen(hass, service, callback):
Service can be a string or a list/tuple.
"""
if not isinstance(service, str):
if isinstance(service, str):
service = (service,)
else:
service = tuple(service)
def discovery_event_listener(event):
""" Listens for discovery events. """

View File

@ -191,7 +191,7 @@ def setup(hass, config):
platform = get_component(
"{}.{}".format(DOMAIN, DISCOVERY_PLATFORMS[service]))
discovered = platform.device_discovered(hass, config, info)
discovered = platform.devices_discovered(hass, config, info)
for light in discovered:
if light is not None and light not in lights.values():

View File

@ -35,9 +35,9 @@ def setup(hass, config):
('light', pywink.get_bulbs, DISCOVER_LIGHTS),
('switch', pywink.get_switches, DISCOVER_SWITCHES)):
component = get_component(component_name)
if func_exists():
component = get_component(component_name)
# Ensure component is loaded
if component.DOMAIN not in hass.components:
# Add a worker on succesfull setup
@ -49,3 +49,5 @@ def setup(hass, config):
ATTR_SERVICE: discovery_type,
ATTR_DISCOVERED: {}
})
return True