pool_control_master_db.py
def is_pool_pump_running():
    log.debug("is_pool_pump_running() started.")
    """ Function to determine if our pool pump is running. This utilizes the pump_control_software and
    if the pump control software is not running it looks up how many watts are being  used by the pool
    panel. This should not e confused with the function pool_pump_running_ch() which utilizes GPIO 38 to detect
    if the pump is running utilizing a float switch connected to our pH/ORP chemical pot """
    # debug("is_pool_pump_running() Started")
    pump_control_active = read_database("pump_status", "pump_control_active")
    if pooldb.PUMP_DATA == "NODEJS":
        if pump_control_active:
            pool_pump_running_watts = get_pump_data("watts")
        else:
            pool_pump_running_watts = read_emoncms_database("data", pooldb.pump_running_watts_table)
            pool_pump_running_watts = int("%1.0f" % pool_pump_running_watts)
    else:
        pool_pump_running_watts = read_emoncms_database("data", pooldb.pump_running_watts_table)
        pool_pump_running_watts = int("%1.0f" % pool_pump_running_watts)
    log.info("pool_pump_running_watts returned {} watts in use by the pump.".format(pool_pump_running_watts))
    update_database("pump_status", "pump_watts", pool_pump_running_watts)

    if pool_pump_running_watts > pooldb.max_wattage:
        led_control(pump_run_led, "True")
        pool_pump_running = True
        update_database("led_status", "pump_run_led", True)
        update_database("pump_status", "pump_running", True)
        log.debug("PUMP_RUN_LED should be ON. This is the YELLOW LED")
        pump_error_notification_sent = read_database("notification_status", "pump_not_running_error_alert_sent")
        if pump_error_notification_sent:
            log.debug("Pump Error CLEARED - Pump is currently programmed to be running and is running.")
            notify("pump_error_notifications", "Pump Error CLEARED - Pump is now Running!", "Your Pool Pump is currnetly programmed to run, and it is now running!")
            update_database("notification_status", "pump_not_running_error_alert_sent", False)
    else:
        led_control(pump_run_led, "False")
        pool_pump_running = False
        update_database("led_status", "pump_run_led", False)
        update_database("pump_status", "pump_running", False)
        if pump_control_active:
            pump_program_running = read_database("pump_status", "pump_program_running")
            if pump_program_running in ("program_1", "program_2", "program_3", "program_4"):
                log.warning("Pump is currently programmed to be running but it is NOT running. Please Check Pool System!")
                pump_error_notification_sent = read_database("notification_status", "pump_not_running_error_alert_sent")
                if not pump_error_notification_sent:
                    notify("pump_error_notifications", "Pump Error - Pump Not Running!", "Your Pool Pump is currnetly programmed to run, but it is not running. Check your system!")
                    update_database("notification_status", "pump_not_running_error_alert_sent", True)
        log.debug("PUMP_RUN_LED should be OFF. This is the YELLOW LED")
    log.debug("is_pool_pump_running() completed.")
    return pool_pump_running
 Function to determine if our pool pump is running. This utilizes the pump_control_software and
    if the pump control software is not running it looks up how many watts are being  used by the pool
    panel. This should not e confused with the function pool_pump_running_ch() which utilizes GPIO 38 to detect
    if the pump is running utilizing a float switch connected to our pH/ORP chemical pot 
Function to determine if our pool pump is running. This utilizes the pump_control_software and
if the pump control software is not running it looks up how many watts are being  used by the pool
panel. This should not e confused with the function pool_pump_running_ch() which utilizes GPIO 38 to detect
if the pump is running utilizing a float switch connected to our pH/ORP chemical pot
Function to determine if our pool pump is running . This utilizes the pump_control_software and if the pump control software is not running it looks up how many watts are being used by the pool panel . This should not e confused with the function pool_pump_running_ch () which utilizes GPIO 38 to detect if the pump is running utilizing a float switch connected to our pH / ORP chemical pot
def is_pool_pump_running():
    log.debug("is_pool_pump_running() started.")
    pump_control_active = read_database("pump_status", "pump_control_active")
    if pooldb.PUMP_DATA == "NODEJS":
        if pump_control_active:
            pool_pump_running_watts = get_pump_data("watts")
        else:
            pool_pump_running_watts = read_emoncms_database("data", pooldb.pump_running_watts_table)
            pool_pump_running_watts = int("%1.0f" % pool_pump_running_watts)
    else:
        pool_pump_running_watts = read_emoncms_database("data", pooldb.pump_running_watts_table)
        pool_pump_running_watts = int("%1.0f" % pool_pump_running_watts)
    log.info("pool_pump_running_watts returned {} watts in use by the pump.".format(pool_pump_running_watts))
    update_database("pump_status", "pump_watts", pool_pump_running_watts)
    if pool_pump_running_watts > pooldb.max_wattage:
        led_control(pump_run_led, "True")
        pool_pump_running = True
        update_database("led_status", "pump_run_led", True)
        update_database("pump_status", "pump_running", True)
        log.debug("PUMP_RUN_LED should be ON. This is the YELLOW LED")
        pump_error_notification_sent = read_database("notification_status", "pump_not_running_error_alert_sent")
        if pump_error_notification_sent:
            log.debug("Pump Error CLEARED - Pump is currently programmed to be running and is running.")
            notify("pump_error_notifications", "Pump Error CLEARED - Pump is now Running!", "Your Pool Pump is currnetly programmed to run, and it is now running!")
            update_database("notification_status", "pump_not_running_error_alert_sent", False)
    else:
        led_control(pump_run_led, "False")
        pool_pump_running = False
        update_database("led_status", "pump_run_led", False)
        update_database("pump_status", "pump_running", False)
        if pump_control_active:
            pump_program_running = read_database("pump_status", "pump_program_running")
            if pump_program_running in ("program_1", "program_2", "program_3", "program_4"):
                log.warning("Pump is currently programmed to be running but it is NOT running. Please Check Pool System!")
                pump_error_notification_sent = read_database("notification_status", "pump_not_running_error_alert_sent")
                if not pump_error_notification_sent:
                    notify("pump_error_notifications", "Pump Error - Pump Not Running!", "Your Pool Pump is currnetly programmed to run, but it is not running. Check your system!")
                    update_database("notification_status", "pump_not_running_error_alert_sent", True)
        log.debug("PUMP_RUN_LED should be OFF. This is the YELLOW LED")
    log.debug("is_pool_pump_running() completed.")
    return pool_pump_running
def is_pool_pump_running ( ) : log . debug ( "is_pool_pump_running() started." ) pump_control_active = read_database ( "pump_status" , "pump_control_active" ) if pooldb . PUMP_DATA == "NODEJS" : if pump_control_active : pool_pump_running_watts = get_pump_data ( "watts" ) else : pool_pump_running_watts = read_emoncms_database ( "data" , pooldb . pump_running_watts_table ) pool_pump_running_watts = int ( "%1.0f" % pool_pump_running_watts ) else : pool_pump_running_watts = read_emoncms_database ( "data" , pooldb . pump_running_watts_table ) pool_pump_running_watts = int ( "%1.0f" % pool_pump_running_watts ) log . info ( "pool_pump_running_watts returned {} watts in use by the pump." . format ( pool_pump_running_watts ) ) update_database ( "pump_status" , "pump_watts" , pool_pump_running_watts ) if pool_pump_running_watts > pooldb . max_wattage : led_control ( pump_run_led , "True" ) pool_pump_running = True update_database ( "led_status" , "pump_run_led" , True ) update_database ( "pump_status" , "pump_running" , True ) log . debug ( "PUMP_RUN_LED should be ON. This is the YELLOW LED" ) pump_error_notification_sent = read_database ( "notification_status" , "pump_not_running_error_alert_sent" ) if pump_error_notification_sent : log . debug ( "Pump Error CLEARED - Pump is currently programmed to be running and is running." ) notify ( "pump_error_notifications" , "Pump Error CLEARED - Pump is now Running!" , "Your Pool Pump is currnetly programmed to run, and it is now running!" ) update_database ( "notification_status" , "pump_not_running_error_alert_sent" , False ) else : led_control ( pump_run_led , "False" ) pool_pump_running = False update_database ( "led_status" , "pump_run_led" , False ) update_database ( "pump_status" , "pump_running" , False ) if pump_control_active : pump_program_running = read_database ( "pump_status" , "pump_program_running" ) if pump_program_running in ( "program_1" , "program_2" , "program_3" , "program_4" ) : log . warning ( "Pump is currently programmed to be running but it is NOT running. Please Check Pool System!" ) pump_error_notification_sent = read_database ( "notification_status" , "pump_not_running_error_alert_sent" ) if not pump_error_notification_sent : notify ( "pump_error_notifications" , "Pump Error - Pump Not Running!" , "Your Pool Pump is currnetly programmed to run, but it is not running. Check your system!" ) update_database ( "notification_status" , "pump_not_running_error_alert_sent" , True ) log . debug ( "PUMP_RUN_LED should be OFF. This is the YELLOW LED" ) log . debug ( "is_pool_pump_running() completed." ) return pool_pump_running
Function to determine if our pool pump is running.
Function to determine if our pool pump is running .
""" Function to determine if our pool pump is running. This utilizes the pump_control_software and
    if the pump control software is not running it looks up how many watts are being  used by the pool
    panel. This should not e confused with the function pool_pump_running_ch() which utilizes GPIO 38 to detect
    if the pump is running utilizing a float switch connected to our pH/ORP chemical pot """ # debug("is_pool_pump_running() Started")