Esempio n. 1
0
def main():
    global myAlarm
    # create an alarm
    g_alarm = Alarm()

    # set alarm data
    # should be updated before the alarm is triggered
    g_alarm.set({'time': datetime.now().strftime("%H:%M:%S")})

    # starts the alarm
    g_alarm.start()

    time.sleep(10)

    # stops the alarm
    # sensors may also stop the alarm
    g_alarm.stop()

    time.sleep(10)
    print "done"

    # call this at program exit to kill child threads
    g_alarm.destr_cb()
Esempio n. 2
0
def setter(arguments, user):
    print(arguments)
    obj = arguments[0]
    setting = arguments[1]
    curr = None
    if obj == "volume":
        if setting == "up":
            Audio.volume_up()
        elif setting == "down":
            Audio.volume_down()
        elif setting == "full":
            Audio.volume_max()
        elif setting == "mute" or setting == "off":
            Audio.mute()
        elif setting == "unmute":
            Audio.mute()
        else:
            Audio.set(int(setting))

        curr = Audio.current_volume()
    if obj == "brightness":
        if setting == "up":
            Brightness.up()
        elif setting == "down":
            Brightness.down()
        elif setting == "full" or setting == "max":
            Brightness.max()
        elif setting == "min":
            Brightness.min()
        else:
            Brightness.set(int(setting))
        curr = Brightness.current_brightness()
    if obj == "alarm":
        Alarm.set(setting)

    return obj + " set to " + str(curr)