Beispiel #1
0
        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
        if not_home_counter == OFF_COUNTER:
            player.pause()
            subprocess.check_output('wemo switch "main" off', shell=True)
            subprocess.check_output('wemo switch "light" off', shell=True)

    # Update playlists at 5:30AM Every Night
    #now = time.gmtime()
    #if update_playlist and now.tm_hour == 10 and now.tm_min == 30:
    #    player.save_playlists()
    #    update_playlist = False 
    #elif now.tm_hour == 5 and now.tm_min == 0:
    #    update_playlist = True

    print home_counter
    print not_home_counter
    startup = False
    time.sleep(10)
Beispiel #2
0
    elif not play_input:
        timer += 1
        if timer == 25:
            player.shuffle(shuffle)
            shuffle = not shuffle

    elif play_input_prev != play_input and play_input:
        print("Play Button Released")
        GPIO.output(LIGHT_PIN, GPIO.LOW)

        if timer < 25:
            state = player.get_state()
            if state == 'paused' or state == 'stopped':
                player.resume()
            else:
                player.pause()

        timer = 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: