Exemple #1
0
def set_relay_state_based_on_temps():
    set_temp = get_set_temp()
    current_temp = get_current_temp()
    print "Set temp is {0} and current temp is {1}".format(set_temp, current_temp)
    desired_relay_state = 0

    if current_temp >= set_temp + upper_temp_slop:
        desired_relay_state = 0

    if current_temp <= set_temp - lower_temp_slop:
        desired_relay_state = 1

    relay_state = get_relay_state()
    if relay_state != desired_relay_state:
        relay_state = desired_relay_state
        set_relay_state(relay_state)
        print "*** Change relay to {0} ***".format(relay_state)
def set_relay_state_based_on_temps():
    set_temp = get_set_temp()
    current_temp = get_current_temp()
    log_data("setTemp: {0}, currentTemp: {1}".format(set_temp, current_temp))
    desired_relay_state = 0

    if current_temp >= set_temp + upper_temp_slop:
        desired_relay_state = 0

    if current_temp <= set_temp - lower_temp_slop:
        desired_relay_state = 1

    relay_state = get_relay_state()
    if relay_state != desired_relay_state:
        relay_state = desired_relay_state
        set_relay_state(relay_state)
        log_info("*** Change relay to {1} ***".format(relay_state))