Exemple #1
0
 def process(self, bulb):
     for b in pywink.get_bulbs():
         if b.name() == bulb:
             self.output.append('turning {0} {1}'.format(
                 bulb, 'off' if b.state() else 'on'))
             b.set_state(not b.state())
             return
Exemple #2
0
def setup_platform(hass, config, add_devices_callback, discovery_info=None):
    """ Find and return Wink lights. """
    import pywink

    token = config.get(CONF_ACCESS_TOKEN)

    if not pywink.is_token_set() and token is None:
        logging.getLogger(__name__).error(
            "Missing wink access_token - "
            "get one at https://winkbearertoken.appspot.com/")
        return

    elif token is not None:
        pywink.set_bearer_token(token)

    add_devices_callback(WinkLight(light) for light in pywink.get_bulbs())
Exemple #3
0
def setup_platform(hass, config, add_devices_callback, discovery_info=None):
    """ Find and return Wink lights. """
    import pywink

    token = config.get(CONF_ACCESS_TOKEN)

    if not pywink.is_token_set() and token is None:
        logging.getLogger(__name__).error(
            "Missing wink access_token - "
            "get one at https://winkbearertoken.appspot.com/")
        return

    elif token is not None:
        pywink.set_bearer_token(token)

    add_devices_callback(
        WinkLight(light) for light in pywink.get_bulbs())
Exemple #4
0
def setup_platform(hass, config, add_devices, discovery_info=None):
    """Setup the Wink lights."""
    import pywink

    add_devices(WinkLight(light) for light in pywink.get_bulbs())
Exemple #5
0
def setup_platform(hass, config, add_devices, discovery_info=None):
    """Setup the Wink lights."""
    import pywink

    add_devices(WinkLight(light) for light in pywink.get_bulbs())
Exemple #6
0
 def process(self, bulbs_on):
     for b in pywink.get_bulbs():
         if b.state() != bulbs_on:
             self.output.append('turning {0} {1}'.format(
                 b.name(), 'on' if bulbs_on else 'off'))
             b.set_state(bulbs_on)
Exemple #7
0
def loop():
    initial_brightness = []
    bulbs = pywink.get_bulbs()

    for bulb in bulbs:  ## turn off main lights
        bulb.set_state(False, brightness=0)

    trigger_ifttt(event="bar_off")

    ##play spooky music
    ps1 = subprocess.Popen(["exec omxplayer -o local spooky.wav"],
                           stdout=DEVNULL,
                           shell=True)

    ## start with a blue glow on lifx
    lifx.set_color_all_lights(BLUE, duration=15)
    time.sleep(15)

    ps1.kill()  ## wait for spooky move to get over

    ##play lightning
    ##play thunder
    ps2 = subprocess.Popen(["exec omxplayer -o local thunder.wav"],
                           stdout=DEVNULL,
                           shell=True)
    thunder()
    ps2.kill()

    ## play spooky music
    trigger_ifttt("spooky")
    ps3 = subprocess.Popen(["exec omxplayer -o local spooky.wav"],
                           stdout=DEVNULL,
                           shell=True)
    lifx.set_color_all_lights(BLUE, duration=15)
    time.sleep(15)
    ps3.kill()

    ##wait for 30 secs
    time.sleep(15)

    ##play lightning
    ##play thunder
    ps4 = subprocess.Popen(["exec omxplayer -o local thunder.wav"],
                           stdout=DEVNULL,
                           shell=True)
    thunder()
    ps4.kill()

    lifx.set_color_all_lights(BLUE, duration=15)
    ## play music
    ## restore house
    ps5 = subprocess.Popen(["exec omxplayer -o local spooky.wav"],
                           stdout=DEVNULL,
                           shell=True)
    time.sleep(10)

    ##turn off TV
    trigger_ifttt("spookend")

    ps5.kill()

    ps6 = subprocess.Popen(["exec omxplayer -o local scream.wav"],
                           stdout=DEVNULL,
                           shell=True)
    time.sleep(2)
    ps6.kill()

    bulbs = pywink.get_bulbs()
    bulbs[0].set_state(True, 0.04)
    bulbs[1].set_state(True, 0.04)

    ## set color back to orange
    lifx.set_color_all_lights(ORANGE, duration=15)
    os.system('killall omxplayer.bin')

    trigger_ifttt(event="bar_on")

    screen_init()  ## restore play screen
Exemple #8
0
 def process(self, bulbs_on):
     for b in pywink.get_bulbs():
         if b.state() != bulbs_on:
             self.output.append('turning {0} {1}'.format(
                 b.name(), 'on' if bulbs_on else 'off'))
             b.set_state(bulbs_on)