예제 #1
0
def humid_contol(humid, use_fans=False):
    global humid_state
    msg = "  no change"
    if cli_output_level == "max":
        print(" ~ ~ ~ humidifier controll function started ~ ~ ~")
    humid_low = float(set_dic['humid_low'])
    if humid < humid_low and humid_state != 'up_on':
        msg = "should turn the humidifer on, it's " + str(
            humid) + " and the low limit is " + str(humid_low)
        if humid_state == 'unknown':
            msg = "Script initialised, humid " + str(
                humid) + ", low limit is " + str(
                    humid_low) + " checking humidifier is on"
        humid_state = 'up_on'
        pigrow_defs.write_log(script, msg, loc_dic['loc_switchlog'])
        humid_on.humid_on(set_dic, loc_dic['loc_switchlog'])
    elif humid > humid_low and humid_state != 'up_off':
        msg = ("should turn the humidifier off, it's " + str(humid) +
               " and the low limit is " + str(humid_low))
        if humid_state == 'unknown':
            msg = "Script initialised, humid " + str(
                humid) + ", low limit is " + str(
                    humid_low) + " checking humidifier is off"
        humid_state = 'up_off'
        pigrow_defs.write_log(script, msg, loc_dic['loc_switchlog'])
        humid_off.humid_off(set_dic, loc_dic['loc_switchlog'])
    if cli_output_level == "max":
        print(msg)
예제 #2
0
def humid_contol(humid, use_fans=False):
    global humid_state
    humid_low = float(set_dic['humid_low'])
    if humid < humid_low and humid_state != 'up_on':
        msg = "should turn the humidifer on, it's " + str(
            humid) + " and the low limit is " + str(humid_low)
        if humid_state == 'unknown':
            msg = "Script initialised, humid " + str(
                humid) + ", low limit is " + str(
                    humid_low) + " checking humidifier is on"
        humid_state = 'up_on'
        pigrow_defs.write_log(script, msg, loc_dic['loc_switchlog'])
        humid_on.humid_on(set_dic, loc_dic['loc_switchlog'])
        if use_fans == True:
            fans_on.fans_on(set_dic, loc_dic['loc_switchlog'])
    elif humid > humid_low and humid_state != 'up_off':
        msg = ("should turn the humidifier off, it's " + str(humid) +
               " and the low limit is " + str(humid_low))
        if humid_state == 'unknown':
            msg = "Script initialised, humid " + str(
                humid) + ", low limit is " + str(
                    humid_low) + " checking humidifier is off"
        humid_state = 'up_off'
        pigrow_defs.write_log(script, msg, loc_dic['loc_switchlog'])
        humid_off.humid_off(set_dic, loc_dic['loc_switchlog'])
        if use_fans == True:
            fans_off.fans_off(set_dic, loc_dic['loc_switchlog'])