Beispiel #1
0
    mac = network.check_macs()
    
    if mac and not startup:
        print 'MAC: %s' % mac
        found = True
        print "Found"
        not_home_counter = 0

        if home_counter < 0:
            home_counter = 0

        elif home_counter == 0:
            state = player.get_state()
            if state == 'paused' or state == 'stopped' and not startup:
                subprocess.check_output('wemo switch "light" on', shell=True)
                player.play_new_playlist()
                subprocess.check_output('wemo switch "main" on', shell=True)

        home_counter += 1

    if not found:
        print "NOT Found"

        if home_counter > 0 and not_home_counter == 0:
            home_counter = OFF_COUNTER
        elif home_counter > 0 and not_home_counter > 0:
            home_counter -= 1

        not_home_counter += 1

        # 10 Mins - Want to be able to walk to bodega and stuff without turning off
Beispiel #2
0
    play_input_prev = play_input

    #####################
    ## NEXT
    #####################
    next_input = GPIO.input(NEXT_PIN)

    if next_input_prev != next_input and not next_input:
        print("Next Button Pressed")
        GPIO.output(LIGHT_PIN, GPIO.HIGH)

    elif not next_input:
        timer += 1
        if timer == 25:
            player.play_new_playlist()

    elif next_input_prev != next_input and next_input:
        print("Next Button Released")
        GPIO.output(LIGHT_PIN, GPIO.LOW)

        if timer < 25:
            player.next_song()

        timer = 0

    next_input_prev = next_input
    time.sleep(0.05)

    #print GPIO.input(NEXT_TRACK_PIN)