Is there a way to disable my pH/EC regulation after a certain amount of dispenses?

Is there a way to disable my pH/EC regulation after a certain amount of dispenses?

The problem I am looking to solve is a way to automate a safeguard if I have a water issue (overflow or trouble with res getting too low) or if I run out of pH or nutrient solutions. Ideally this would just be a simple way to disable the Regulate pH and Electrical Conductivity function and alert me that there is an issue.

Any thoughts or recommendations are welcome :slight_smile:

I am working on something with a conditional function if TDS/EC displays very low but I feel there may be a better way to accomplish thisโ€ฆ

thanks!!

This is what I came up with using a Conditional Function:

self.logger.info("Conditional - Disable pH/Feed Failsafe")

self.loop_count += 1  # Counts how many times the run code has been executed

TDS_measurement = self.condition("0d627767")  # Read TDS
self.logger.info(f"TDS Measurement is {TDS_measurement}")
pH_measurement = self.condition("16841e6b")  # Read pH
self.logger.info(f"pH Measurement is {pH_measurement}")

if TDS_measurement is not None:  # If a measurement exists
    self.message += "TDS Measurement has been read successfully.\n"

    if TDS_measurement < 100:  # If the measurement is less than 100
        self.message += f"TDS Measurement is too Low! Measurement is {TDS_measurement}\n"
        self.message += "Disabling pH and EC Regulation.\n"
        self.run_action("28cddf0a") # Disable Regulate pH and EC Function
        self.run_action("6694062b") # Send email

    if pH_measurement < 5.5:  # If the measurement is less than 5.5
        self.message += f"pH Measurement is too Low! Measurement is {pH_measurement}\n"
        self.message += "Disabling pH and EC Regulation.\n"
        self.run_action("28cddf0a") # Disable Regulate pH and EC Function
        self.run_action("6694062b") # Send email
    elif pH_measurement > 6.4:  # Else If the measurement is greater than 6.4
        self.message += f"pH Measurement is too High! Measurement is {pH_measurement}\n"
        self.message += "Disabling pH and EC Regulation.\n"
        self.run_action("28cddf0a") # Disable Regulate pH and EC Function
        self.run_action("6694062b") # Send email