예제 #1
0
def set_procedure(procedure):
    statuses = {}
    db_save = True
    expire_delta = 120
    if procedure == "lights_on":
        statuses = {"865": True, "led": True, "led_rgb": True}
    elif procedure == "lights_off":
        statuses = {"865": False, "led": False, "led_rgb": False}
    elif procedure == "movie":
        expire_delta = 150
        statuses = {"865": False, "led": False, "led_rgb": True}
    elif procedure == "schimb_apa":
        statuses = {"865": False, "led": True, "led_rgb": True, "pompa": False, "incalzitor": False}
    elif procedure == "feed":
        expire_delta = 10
        statuses = {"pompa": False}
    elif procedure == "reset":
        db_save = False
        TempCommands.clear_all()
        statuses = get_statuses()

    if db_save:
        TempCommands.add_entry(statuses, expire_delta)

    IO.set_pins(statuses)

    return procedure
예제 #2
0
def reload_pins():
    statuses = get_statuses()
    IO.set_pins(statuses)

    return str(statuses)