Ejemplo n.º 1
0
    """
    msg = "command usage:\n"
    msg += "\t/start : start the home monitoring system \n"
    msg += "\t/stop  : stop the home monitoring system\n"
    msg += "\t/show  : show the status of the monitoring system \n"
    msg += "\t/photo : take a picture\n"
    msg += "\t/video time=<delay> : records a video, argument time defines the duration of the recording\n"
    msg += "\t/clean : remove all files in video folder\n"
    msg += "\t/help  : show help\n"
    return bot.send_message(msg)


@bot.handler("/clean")
def on_clean():
    """
    command /clean: remove file in REGISTRATION_FOLDER
    """
    return bot.send_message(camera.purge_records())


print('I am listening ...')
try:
    while True:
        if bot.is_listen and pir.movement_detected():
            bot.send_video(camera.start_recording(VIDEO_TIME),
                           'motion detected')
        else:
            time.sleep(1)
except KeyboardInterrupt:
    del camera
Ejemplo n.º 2
0
    :return: string
    """
    msg = "command usage:\n"
    msg += "\t/start : start the home monitoring system \n"
    msg += "\t/stop  : stop the home monitoring system\n"
    msg += "\t/status  : show the status of the monitoring system \n"
    msg += "\t/photo : take a picture\n"
    msg += "\t/video <delay> : records a video, by default delay is " + str(VIDEO_TIME) + "s \n"
    msg += "\t/clean : remove all files in video folder\n"
    msg += "\t/help  : show help\n"
    return bot.send_message(msg)


@bot.handler("/clean")
def on_clean():
    """
    command /clean: remove file in REGISTRATION_FOLDER
    """
    return bot.send_message(camera.purge_records())


print('I am listening ...')
try:
    while True:
        if bot.is_listen and pir.movement_detected():
            bot.send_video(camera.start_recording(VIDEO_TIME), 'motion detected')
        else:
            time.sleep(1)
except KeyboardInterrupt:
    del camera