Ejemplo n.º 1
0
def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the Wink lights."""

    for light in pywink.get_light_bulbs():
        _id = light.object_id() + light.name()
        if _id not in hass.data[DOMAIN]["unique_ids"]:
            add_entities([WinkLight(light, hass)])
    for light in pywink.get_light_groups():
        _id = light.object_id() + light.name()
        if _id not in hass.data[DOMAIN]["unique_ids"]:
            add_entities([WinkLight(light, hass)])
Ejemplo n.º 2
0
def setup_platform(hass, config, add_devices, discovery_info=None):
    """Set up the Wink lights."""
    import pywink

    for light in pywink.get_light_bulbs():
        _id = light.object_id() + light.name()
        if _id not in hass.data[DOMAIN]['unique_ids']:
            add_devices([WinkLight(light, hass)])
    for light in pywink.get_light_groups():
        _id = light.object_id() + light.name()
        if _id not in hass.data[DOMAIN]['unique_ids']:
            add_devices([WinkLight(light, hass)])
Ejemplo n.º 3
0
 def listGroups(self):
     r = ""
     groups = pywink.get_light_groups()
     for g in groups:
         r += '{color}{name} ({type}) - {state}\n```'.format(
             color=("```css\n" if g.state() else "```brainfuck\n"),
             name=g.name(),
             type='lights',
             state=("ON" if g.state() else "OFF"))
     groups = pywink.get_binary_switch_groups()
     for g in groups:
         r += '{color}{name} ({type}) - {state}\n```'.format(
             color=("```css\n" if g.state() else "```brainfuck\n"),
             name=g.name(),
             type='switches',
             state=("ON" if g.state() else "OFF"))
     groups = pywink.get_shade_groups()
     for g in groups:
         r += '{color}{name} ({type}) - {state}\n```'.format(
             color=("```css\n" if g.state() else "```brainfuck\n"),
             name=g.name(),
             type='shades',
             state=("ON" if g.state() else "OFF"))
     return r
Ejemplo n.º 4
0
 def getGroup(self, name):
     groups = pywink.get_light_groups()
     for g in groups:
         if g.name().lower() == name.lower():
             return g, g.object_type()
     return None, None