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

    for switch in pywink.get_switches():
        _id = switch.object_id() + switch.name()
        if _id not in hass.data[DOMAIN]["unique_ids"]:
            add_entities([WinkToggleDevice(switch, hass)])
    for switch in pywink.get_powerstrips():
        _id = switch.object_id() + switch.name()
        if _id not in hass.data[DOMAIN]["unique_ids"]:
            add_entities([WinkToggleDevice(switch, hass)])
    for sprinkler in pywink.get_sprinklers():
        _id = sprinkler.object_id() + sprinkler.name()
        if _id not in hass.data[DOMAIN]["unique_ids"]:
            add_entities([WinkToggleDevice(sprinkler, hass)])
    for switch in pywink.get_binary_switch_groups():
        _id = switch.object_id() + switch.name()
        if _id not in hass.data[DOMAIN]["unique_ids"]:
            add_entities([WinkToggleDevice(switch, hass)])
Esempio n. 2
0
def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the Wink platform."""
    import pywink

    for switch in pywink.get_switches():
        _id = switch.object_id() + switch.name()
        if _id not in hass.data[DOMAIN]['unique_ids']:
            add_entities([WinkToggleDevice(switch, hass)])
    for switch in pywink.get_powerstrips():
        _id = switch.object_id() + switch.name()
        if _id not in hass.data[DOMAIN]['unique_ids']:
            add_entities([WinkToggleDevice(switch, hass)])
    for sprinkler in pywink.get_sprinklers():
        _id = sprinkler.object_id() + sprinkler.name()
        if _id not in hass.data[DOMAIN]['unique_ids']:
            add_entities([WinkToggleDevice(sprinkler, hass)])
    for switch in pywink.get_binary_switch_groups():
        _id = switch.object_id() + switch.name()
        if _id not in hass.data[DOMAIN]['unique_ids']:
            add_entities([WinkToggleDevice(switch, hass)])
Esempio 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