Getting a Conditional Controller to regulate EC and pH working

Hello,
after a long time waiting for my parts, now everything is here and connected,
but there are some more questions.
I dont know which id i must set in the custom python code to get the pumps running.
I can run them manually in the output module, can set amount and can set duration, but they dont run automatically to regulate ec and ph.

Is there an issue with my ID`s ?
This is what i have done :

I have found these id`s in the input modul when i put the cursor
on the name ( Atlas_PH) , is this correct ?
UUID : e755ff3c-0a54-4d87-9c5d-bf3685af032d

Edit below to set the IDs for Conditions and Actions ###
condition_id_measurement_ph_id = e755ff3c-0a54-4d87-9c5d-bf3685af032d # Condition: measurement, last, pH Input
condition_id_measurement_ec_id =  7c221512-b80d-4661-b5ca-fc976f34ae39# Condition: measurement, last, EC Input
action_id_pump_1_acid = ACID_PUMP  # Action: Pump 1 (Acid)
action_id_pump_2_base = BASE_PUMP  # Action: Pump 2 (Base)
action_id_pump_3_nutrient_a = A_COMPONENT  # Action: Pump 3 (Nutrient A)
action_id_pump_4_nutrient_b = B_COMPONENT  # Action: Pump 4 (Nutrient B)
action_id_email_notification = "{EMAIL_ID}"  # Action: Email Notification

and here is the log

2021-05-30 13:10:56,198 - ERROR - mycodo.controllers.controller_conditional_2631d842 - initialize_variables() Exception: invalid syntax (conditional_2631d842-edfe-4027-a60e-e1aa823dd8f4.py, line 30)
Traceback (most recent call last):
  File "/var/mycodo-root/mycodo/controllers/base_controller.py", line 74, in run
    self.initialize_variables()
  File "/var/mycodo-root/mycodo/controllers/controller_conditional.py", line 126, in initialize_variables
    spec.loader.exec_module(conditional_run)
  File "<frozen importlib._bootstrap_external>", line 724, in exec_module
  File "<frozen importlib._bootstrap_external>", line 860, in get_code
  File "<frozen importlib._bootstrap_external>", line 791, in source_to_code
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/pi/Mycodo/mycodo/user_python_code/conditional_2631d842-edfe-4027-a60e-e1aa823dd8f4.py", line 30
    condition_id_measurement_ph_id = e755ff3c-0a54-4d87-9c5d-bf3685af032d # Condition: measurement, last, pH Input
                                                 ^
SyntaxError: invalid syntax
2021-05-30 13:10:56,200 - INFO - mycodo.controllers.controller_conditional_2631d842 - Activated in 70.5 ms
2021-05-30 13:10:58,436 - INFO - mycodo.function.bang_bang_728fde22 - Input: 20.58764477247023, output: on, target: 22.0, hyst: 2.0
2021-05-30 13:10:59,596 - INFO - mycodo.function.bang_bang_97a00c8a - Input: 19.125, output: on, target: 22.0, hyst: 1.0
2021-05-30 13:11:00,515 - INFO - mycodo.function.bang_bang_60d080c9 - Input: 53.80925751346696, output: off, target: 50.0, hyst: 10.0
2021-05-30 13:11:03,231 - INFO - mycodo.function.bang_bang_728fde22 - Input: 20.58764477247023, output: on, target: 22.0, hyst: 2.0
2021-05-30 13:11:04,518 - INFO - mycodo.function.bang_bang_97a00c8a - Input: 19.125, output: on, target: 22.0, hyst: 1.0
2021-05-30 13:11:05,120 - INFO - mycodo.function.bang_bang_60d080c9 - Input: 53.80925751346696, output: off, target: 50.0, hyst: 10.0
2021-05-30 13:11:06,459 - ERROR - mycodo.controllers.controller_conditional_2631d842 - Exception executing check_conditionals() on attempt 1 of 3. Waiting 10 seconds and trying again.
Traceback (most recent call last):
  File "/var/mycodo-root/mycodo/controllers/base_controller.py", line 124, in attempt_execute
    func()
  File "/var/mycodo-root/mycodo/controllers/controller_conditional.py", line 176, in check_conditionals
    self.conditional_run.message = message
AttributeError: 'NoneType' object has no attribute 'message'
2021-05-30 13:11:08,321 - INFO - mycodo.function.bang_bang_728fde22 - Input: 20.58764477247023, output: on, target: 22.0, hyst: 2.0
2021-05-30 13:11:09,393 - INFO - mycodo.function.bang_bang_97a00c8a - Input: 19.125, output: on, target: 22.0, hyst: 1.0
2021-05-30 13:11:10,244 - INFO - mycodo.function.bang_bang_60d080c9 - Input: 53.80925751346696, output: off, target: 50.0, hyst: 10.0
2021-05-30 13:11:13,443 - INFO - mycodo.function.bang_bang_728fde22 - Input: 20.556829137547176, output: on, target: 22.0, hyst: 2.0
2021-05-30 13:11:14,505 - INFO - mycodo.function.bang_bang_97a00c8a - Input: 19.0625, output: on, target: 22.0, hyst: 1.0
2021-05-30 13:11:15,094 - INFO - mycodo.function.bang_bang_60d080c9 - Input: 53.106076821874815, output: off, target: 50.0, hyst: 10.0
2021-05-30 13:11:16,504 - ERROR - mycodo.controllers.controller_conditional_2631d842 - Exception executing check_conditionals() on attempt 2 of 3. Waiting 10 seconds and trying again.
Traceback (most recent call last):
  File "/var/mycodo-root/mycodo/controllers/base_controller.py", line 124, in attempt_execute
    func()
  File "/var/mycodo-root/mycodo/controllers/controller_conditional.py", line 176, in check_conditionals
    self.conditional_run.message = message
AttributeError: 'NoneType' object has no attribute 'message'
1 Like

It was a tad confusing for me as well. But you need the ID of the controller conditions, not the inputs themselves. It will look something like this. Goes both to the input and the output

1 Like

Thank you, now i now which id i need …

1 Like

there are some more errors in the log, whats wrong here ?

2021-05-30 14:03:52,885 - ERROR - mycodo.controllers.controller_conditional_2631d842 - initialize_variables() Exception: invalid syntax (conditional_2631d842-edfe-4027-a60e-e1aa823dd8f4.py, line 92)
Traceback (most recent call last):
  File "/var/mycodo-root/mycodo/controllers/base_controller.py", line 74, in run
    self.initialize_variables()
  File "/var/mycodo-root/mycodo/controllers/controller_conditional.py", line 126, in initialize_variables
    spec.loader.exec_module(conditional_run)
  File "<frozen importlib._bootstrap_external>", line 724, in exec_module
  File "<frozen importlib._bootstrap_external>", line 860, in get_code
  File "<frozen importlib._bootstrap_external>", line 791, in source_to_code
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/pi/Mycodo/mycodo/user_python_code/conditional_2631d842-edfe-4027-a60e-e1aa823dd8f4.py", line 92
    .
    ^
SyntaxError: invalid syntax
2021-05-30 14:03:52,886 - INFO - mycodo.controllers.controller_conditional_2631d842 - Activated in 75.7 ms

Could you paste your code here or attach it

is this the code i should show ?

### Edit below to set desired ranges for pH and electrical conductivity ###
# Desired range for electrical conductivity
range_ec_high = 1300
range_ec_low = 1000
# Desired range for pH
range_ph_high = 6.4
range_ph_low = 6.0
# pH range that will immediately cause a pH correction
range_ph_high_danger = 7.0
range_ph_low_danger = 5.0
### Edit below to set the IDs for Conditions and Actions ###
condition_id_measurement_ph_id = "{01c7553c}"# Condition: measurement, last, pH Input
condition_id_measurement_ec_id = "{380117f1}"# Condition: measurement, last, EC Input
action_id_pump_1_acid = "{d0b02511}" # Action: Pump 1 (Acid)
action_id_pump_2_base = "{d21f8fb3}" # Action: Pump 2 (Base)
action_id_pump_3_nutrient_a = "{fc19a918}" # Action: Pump 3 (Nutrient A)
action_id_pump_4_nutrient_b =  "{848e6867}" # Action: Pump 4 (Nutrient B)
### DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING ###
import time
if 'notify_ec' not in self.variables:  # Initiate EC notification timer
    self.variables['notify_ec'] = 0
if 'notify_ph' not in self.variables:  # Initiate pH notification timer
    self.variables['notify_ph'] = 0
if 'notify_none' not in self.variables:  # Initiate None measurement notification timer
    self.variables['notify_none'] = 0
measure_ec = self.condition(condition_id_measurement_ec_id)
measure_ph = self.condition(condition_id_measurement_ph_id)
self.logger.debug("Conditional check. EC: {}, pH: {}".format(measure_ec, measure_ph))
if None in [measure_ec, measure_ph]:
    if measure_ec is None:
        self.message += "\nWarning: No EC Measurement! Check sensor!"
    if measure_ph is None:
        self.message += "\nWarning: No pH Measurement! Check sensor!"
    if self.variables['notify_none'] < time.time():  # Only notify every 12 hours
        self.variables['notify_none'] = time.time() + 43200  # 12 hours
        self.run_action(action_id_email_notification, message=self.message)  # Email alert
    return
# First check if pH is dangerously low or high, and adjust if it is
if measure_ph < range_ph_low_danger:  # pH dangerously low, add base (pH up)
    msg = "pH is dangerously low: {}. Should be > {}. Dispensing 1 ml base".format(measure_ph, range_ph_low_danger)
    self.logger.debug(msg)
    self.message += msg
    self.run_action(action_id_pump_2_base)  # Dispense 1 ml base (pH up)
    if self.variables['notify_ph'] < time.time():  # Only notify every 12 hours
        self.variables['notify_ph'] = time.time() + 43200  # 12 hours
        self.run_action(action_id_email_notification, message=self.message)  # Email alert
elif measure_ph > range_ph_high_danger:  # pH dangerously high, add acid (pH down)
    msg = "pH is dangerously high: {}. Should be < {}. Dispensing 1 ml acid".format(measure_ph, range_ph_high_danger)
    self.logger.debug(msg)
    self.message += msg
    self.run_action(action_id_pump_1_acid)  # Dispense 1 ml acid (pH down)
    if self.variables['notify_ph'] < time.time():  # Only notify every 12 hours
        self.variables['notify_ph'] = time.time() + 43200  # 12 hours
        self.run_action(action_id_email_notification, message=self.message)  # Email alert
# If pH isn't dangerously low or high, check if EC is within range
elif measure_ec < range_ec_low:  # EC too low, add nutrient
    self.logger.debug("EC: {}. Should be > {}. Dosing 3 ml Nut A, 3 ml Nut B".format(measure_ec, range_ec_low))
    self.run_action(action_id_pump_3_nutrient_a)  # Dispense 3 ml nutrient A
    self.run_action(action_id_pump_4_nutrient_b)  # Dispense 3 ml nutrient B
elif measure_ec > range_ec_high:  # EC too high, add nutrient
    msg = "EC: {}. Should be < {}. Need to add water to dilute!".format(measure_ec, range_ec_high)
    self.logger.debug(msg)
    if self.variables['notify_ec'] < time.time():  # Only notify every 12 hours
        self.variables['notify_ec'] = time.time() + 43200  # 12 hours
        self.message += msg
        self.run_action(action_id_email_notification, message=self.message)  # Email alert
# If EC is in range, make sure pH is within range
elif measure_ph < range_ph_low:  # pH too low, add base (pH up)
    self.logger.debug("pH is {}. Should be > {}. Dispensing 1 ml base".format(measure_ph, range_ph_low))
    self.run_action(action_id_pump_2_base)  # Dispense 1 ml base (pH up)
elif measure_ph > range_ph_high:  # pH too high, add acid (pH down)
    self.logger.debug("pH is {}. Should be < {}. Dispensing 1 ml acid".format(measure_ph, range_ph_high))
    self.run_action(action_id_pump_1_acid)  # Dispense 1 ml acid (pH down)

and this is the log.

2021-05-30 15:35:16,830 - ERROR - mycodo.controllers.controller_conditional_2631d842 - Exception executing check_conditionals() on attempt 2 of 3. Waiting 10 seconds and trying again.
Traceback (most recent call last):
  File "/var/mycodo-root/mycodo/controllers/base_controller.py", line 124, in attempt_execute
    func()
  File "/var/mycodo-root/mycodo/controllers/controller_conditional.py", line 176, in check_conditionals
    self.conditional_run.message = message
AttributeError: 'NoneType' object has no attribute 'message'
2021-05-30 15:35:18,249 - INFO - mycodo.function.bang_bang_728fde22 - Input: 20.222993764118293, output: on, target: 22.0, hyst: 2.0
2021-05-30 15:35:19,545 - INFO - mycodo.function.bang_bang_97a00c8a - Input: 19.25, output: on, target: 22.0, hyst: 1.0
2021-05-30 15:35:20,043 - INFO - mycodo.function.bang_bang_60d080c9 - Input: 52.64008867177723, output: off, target: 50.0, hyst: 10.0
2021-05-30 15:35:23,340 - INFO - mycodo.function.bang_bang_728fde22 - Input: 20.222993764118293, output: on, target: 22.0, hyst: 2.0
2021-05-30 15:35:24,455 - INFO - mycodo.function.bang_bang_97a00c8a - Input: 19.25, output: on, target: 22.0, hyst: 1.0
2021-05-30 15:35:25,127 - INFO - mycodo.function.bang_bang_60d080c9 - Input: 52.64008867177723, output: off, target: 50.0, hyst: 10.0
2021-05-30 15:35:26,917 - ERROR - mycodo.controllers.controller_conditional_2631d842 - Exception executing check_conditionals() on attempt 3 of 3.
Traceback (most recent call last):
  File "/var/mycodo-root/mycodo/controllers/base_controller.py", line 124, in attempt_execute
    func()
  File "/var/mycodo-root/mycodo/controllers/controller_conditional.py", line 176, in check_conditionals
    self.conditional_run.message = message
AttributeError: 'NoneType' object has no attribute 'message'

i have removed the dot in line 93 and my log shows this:

2021-05-30 15:41:45,074 - INFO - mycodo.function.bang_bang_60d080c9 - Input: 52.62843223276723, output: off, target: 50.0, hyst: 10.0
2021-05-30 15:41:48,223 - INFO - mycodo.function.bang_bang_728fde22 - Input: 20.366799620375968, output: on, target: 22.0, hyst: 2.0
2021-05-30 15:41:49,446 - INFO - mycodo.function.bang_bang_97a00c8a - Input: 19.25, output: on, target: 22.0, hyst: 1.0
2021-05-30 15:41:50,204 - INFO - mycodo.function.bang_bang_60d080c9 - Input: 52.62843223276723, output: off, target: 50.0, hyst: 10.0
2021-05-30 15:41:53,305 - INFO - mycodo.function.bang_bang_728fde22 - Input: 20.366799620375968, output: on, target: 22.0, hyst: 2.0
2021-05-30 15:41:54,544 - INFO - mycodo.function.bang_bang_97a00c8a - Input: 19.25, output: on, target: 22.0, hyst: 1.0
2021-05-30 15:41:55,036 - INFO - mycodo.function.bang_bang_60d080c9 - Input: 52.62843223276723, output: off, target: 50.0, hyst: 10.0
2021-05-30 15:41:57,267 - INFO - mycodo.controllers.controller_conditional_2631d842 - Refreshing conditional settings
2021-05-30 15:41:58,409 - INFO - mycodo.function.bang_bang_728fde22 - Input: 20.443838565802434, output: on, target: 22.0, hyst: 2.0
2021-05-30 15:41:59,387 - INFO - mycodo.function.bang_bang_97a00c8a - Input: 19.25, output: on, target: 22.0, hyst: 1.0
2021-05-30 15:42:00,127 - INFO - mycodo.function.bang_bang_60d080c9 - Input: 52.379160467914666, output: off, target: 50.0, hyst: 10.0
2021-05-30 15:42:03,231 - INFO - mycodo.function.bang_bang_728fde22 - Input: 20.443838565802434, output: on, target: 22.0, hyst: 2.0
2021-05-30 15:42:04,501 - INFO - mycodo.function.bang_bang_97a00c8a - Input: 19.25, output: on, target: 22.0, hyst: 1.0
2021-05-30 15:42:05,205 - INFO - mycodo.function.bang_bang_60d080c9 - Input: 52.379160467914666, output: off, target: 50.0, hyst: 10.0
2021-05-30 15:42:08,345 - INFO - mycodo.function.bang_bang_728fde22 - Input: 20.443838565802434, output: on, target: 22.0, hyst: 2.0
2021-05-30 15:42:09,597 - INFO - mycodo.function.bang_bang_97a00c8a - Input: 19.25, output: on, target: 22.0, hyst: 1.0
2021-05-30 15:42:10,076 - INFO - mycodo.function.bang_bang_60d080c9 - Input: 52.379160467914666, output: off, target: 50.0, hyst: 10.0
2021-05-30 15:42:13,416 - INFO - mycodo.function.bang_bang_728fde22 - Input: 20.49006196449045, output: on, target: 22.0, hyst: 2.0
2021-05-30 15:42:14,458 - INFO - mycodo.function.bang_bang_97a00c8a - Input: 19.25, output: on, target: 22.0, hyst: 1.0
2021-05-30 15:42:15,149 - INFO - mycodo.function.bang_bang_60d080c9 - Input: 52.658401600959266, output: off, target: 50.0, hyst: 10.0
2021-05-30 15:42:17,287 - INFO - mycodo.controllers.controller_conditional_2631d842 - Deactivated in 45.9 ms
2021-05-30 15:42:18,265 - INFO - mycodo.function.bang_bang_728fde22 - Input: 20.49006196449045, output: on, target: 22.0, hyst: 2.0
2021-05-30 15:42:19,546 - INFO - mycodo.function.bang_bang_97a00c8a - Input: 19.25, output: on, target: 22.0, hyst: 1.0
2021-05-30 15:42:20,260 - INFO - mycodo.function.bang_bang_60d080c9 - Input: 52.658401600959266, output: off, target: 50.0, hyst: 10.0
2021-05-30 15:42:22,559 - INFO - mycodo.controllers.controller_conditional_2631d842 - Activated in 100.7 ms
2021-05-30 15:42:23,354 - INFO - mycodo.function.bang_bang_728fde22 - Input: 20.49006196449045, output: on, target: 22.0, hyst: 2.0
2021-05-30 15:42:24,492 - INFO - mycodo.function.bang_bang_97a00c8a - Input: 19.25, output: on, target: 22.0, hyst: 1.0
2021-05-30 15:42:25,128 - INFO - mycodo.function.bang_bang_60d080c9 - Input: 52.658401600959266, output: off, target: 50.0, hyst: 10.0
2021-05-30 15:42:28,435 - INFO - mycodo.function.bang_bang_728fde22 - Input: 20.48492603013874, output: on, target: 22.0, hyst: 2.0
2021-05-30 15:42:29,369 - INFO - mycodo.function.bang_bang_97a00c8a - Input: 19.25, output: on, target: 22.0, hyst: 1.0

I am using testmodul no 7 for Motordriver TB 6612 FNG Board 1.0

Strings need to be enclosed in quotes.

i have done and i have changed the outputmodul to

Ausgabe: Grove I2C Motor Driver (TB6612FNG, Board v1.0
condition_id_measurement_ph_id = β€œ{01c7553c}”# Condition: measurement, last, pH Input
condition_id_measurement_ec_id = β€œ{380117f1}”# Condition: measurement, last, EC Input
action_id_pump_1_acid = β€œ{d0b02511}” # Action: Pump 1 (Acid)
action_id_pump_2_base = β€œ{d21f8fb3}” # Action: Pump 2 (Base)
action_id_pump_3_nutrient_a = β€œ{fc19a918}” # Action: Pump 3 (Nutrient A)
action_id_pump_4_nutrient_b = β€œ{848e6867}” # Action: Pump 4 (Nutrient B)
action_id_email_notification = β€œ{EMAIL_ID}” # Action: Email Notification

DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING

after activating the conditional this appears:

Erfolg: Daemon-Antwort Conditional settings successfully refreshed
Erfolg: Γ„ndern Bedingungen

Γ—

Info: Review your code for issues and test before putting it into a production environment.
Info: 


Full Conditional Statement code:

  1: import os
  2: import sys
  3: sys.path.append(os.path.abspath('/var/mycodo-root'))
  4: from mycodo.controllers.base_conditional import AbstractConditional
  5: from mycodo.mycodo_client import DaemonControl
  6: control = DaemonControl()
  7: 
  8: class ConditionalRun(AbstractConditional):
  9:     def __init__(self, logger, function_id, message):
 10:         super(ConditionalRun, self).__init__(logger, function_id, message)
 11: 
 12:         self.logger = logger
 13:         self.function_id = function_id
 14:         self.variables = {}
 15:         self.message = message
 16:         self.running = True
 17: 
 18:     def conditional_code_run(self):
 19:         ### Edit below to set desired ranges for pH and electrical conductivity ###
 20:         # Desired range for electrical conductivity
 21:         range_ec_high = 1300
 22:         range_ec_low = 1000
 23:         # Desired range for pH
 24:         range_ph_high = 6.4
 25:         range_ph_low = 6.0
 26:         # pH range that will immediately cause a pH correction
 27:         range_ph_high_danger = 7.0
 28:         range_ph_low_danger = 5.0
 29:         ### Edit below to set the IDs for Conditions and Actions ###
 30:         condition_id_measurement_ph_id = "01c7553c-1aae-4d9f-873a-dc45507c53dc" # Condition: measurement, last, pH Input
 31:         condition_id_measurement_ec_id = "380117f1-fbcc-4318-af6e-82916fe2d98f" # Condition: measurement, last, EC Input
 32:         action_id_pump_1_acid = "d0b02511-2973-40c2-8509-58d4033d2272" # Action: Pump 1 (Acid)
 33:         action_id_pump_2_base = "d21f8fb3-7eba-4a08-99b1-1ad970856f46" # Action: Pump 2 (Base)
 34:         action_id_pump_3_nutrient_a = "fc19a918-fcdb-4556-9276-f7b51afea2b9" # Action: Pump 3 (Nutrient A)
 35:         action_id_pump_4_nutrient_b =  "848e6867-8bb0-42cd-a808-7961d9d4dcc9" # Action: Pump 4 (Nutrient B)
 36:         action_id_email_notification = "{EMAIL_ID}" # Action: Email Notification
 37:         ### DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING ###
 38:         import time
 39:         if 'notify_ec' not in self.variables:  # Initiate EC notification timer
 40:             self.variables['notify_ec'] = 0
 41:         if 'notify_ph' not in self.variables:  # Initiate pH notification timer
 42:             self.variables['notify_ph'] = 0
 43:         if 'notify_none' not in self.variables:  # Initiate None measurement notification timer
 44:             self.variables['notify_none'] = 0
 45:         measure_ec = self.condition(condition_id_measurement_ec_id)
 46:         measure_ph = self.condition(condition_id_measurement_ph_id)
 47:         self.logger.debug("Conditional check. EC: {}, pH: {}".format(measure_ec, measure_ph))
 48:         if None in [measure_ec, measure_ph]:
 49:             if measure_ec is None:
 50:                 self.message += "\nWarning: No EC Measurement! Check sensor!"
 51:             if measure_ph is None:
 52:                 self.message += "\nWarning: No pH Measurement! Check sensor!"
 53:             if self.variables['notify_none'] < time.time():  # Only notify every 12 hours
 54:                 self.variables['notify_none'] = time.time() + 43200  # 12 hours
 55:                 self.run_action(action_id_email_notification, message=self.message)  # Email alert
 56:             return
 57:         # First check if pH is dangerously low or high, and adjust if it is
 58:         if measure_ph < range_ph_low_danger:  # pH dangerously low, add base (pH up)
 59:             msg = "pH is dangerously low: {}. Should be > {}. Dispensing 1 ml base".format(measure_ph, range_ph_low_danger)
 60:             self.logger.debug(msg)
 61:             self.message += msg
 62:             self.run_action(action_id_pump_2_base)  # Dispense 1 ml base (pH up)
 63:             if self.variables['notify_ph'] < time.time():  # Only notify every 12 hours
 64:                 self.variables['notify_ph'] = time.time() + 43200  # 12 hours
 65:                 self.run_action(action_id_email_notification, message=self.message)  # Email alert
 66:         elif measure_ph > range_ph_high_danger:  # pH dangerously high, add acid (pH down)
 67:             msg = "pH is dangerously high: {}. Should be < {}. Dispensing 1 ml acid".format(measure_ph, range_ph_high_danger)
 68:             self.logger.debug(msg)
 69:             self.message += msg
 70:             self.run_action(action_id_pump_1_acid)  # Dispense 1 ml acid (pH down)
 71:             if self.variables['notify_ph'] < time.time():  # Only notify every 12 hours
 72:                 self.variables['notify_ph'] = time.time() + 43200  # 12 hours
 73:                 self.run_action(action_id_email_notification, message=self.message)  # Email alert
 74:         # If pH isn't dangerously low or high, check if EC is within range
 75:         elif measure_ec < range_ec_low:  # EC too low, add nutrient
 76:             self.logger.debug("EC: {}. Should be > {}. Dosing 3 ml Nut A, 3 ml Nut B".format(measure_ec, range_ec_low))
 77:             self.run_action(action_id_pump_3_nutrient_a)  # Dispense 3 ml nutrient A
 78:             self.run_action(action_id_pump_4_nutrient_b)  # Dispense 3 ml nutrient B
 79:         elif measure_ec > range_ec_high:  # EC too high, add nutrient
 80:             msg = "EC: {}. Should be < {}. Need to add water to dilute!".format(measure_ec, range_ec_high)
 81:             self.logger.debug(msg)
 82:             if self.variables['notify_ec'] < time.time():  # Only notify every 12 hours
 83:                 self.variables['notify_ec'] = time.time() + 43200  # 12 hours
 84:                 self.message += msg
 85:                 self.run_action(action_id_email_notification, message=self.message)  # Email alert
 86:         # If EC is in range, make sure pH is within range
 87:         elif measure_ph < range_ph_low:  # pH too low, add base (pH up)
 88:             self.logger.debug("pH is {}. Should be > {}. Dispensing 1 ml base".format(measure_ph, range_ph_low))
 89:             self.run_action(action_id_pump_2_base)  # Dispense 1 ml base (pH up)
 90:         elif measure_ph > range_ph_high:  # pH too high, add acid (pH down)
 91:             self.logger.debug("pH is {}. Should be < {}. Dispensing 1 ml acid".format(measure_ph, range_ph_high))
 92:             self.run_action(action_id_pump_1_acid)  # Dispense 1 ml acid (pH down)


Conditional Statement code analysis:

************* Module mycodo.user_python_code.conditional_2631d842-edfe-4027-a60e-e1aa823dd8f4
pi/Mycodo/mycodo/user_python_code/conditional_2631d842-edfe-4027-a60e-e1aa823dd8f4.py:35:36: C0326: Exactly one space required after assignment
        action_id_pump_4_nutrient_b =  "848e6867-8bb0-42cd-a808-7961d9d4dcc9" # Action: Pump 4 (Nutrient B)
                                    ^ (bad-whitespace)
pi/Mycodo/mycodo/user_python_code/conditional_2631d842-edfe-4027-a60e-e1aa823dd8f4.py:93:0: C0305: Trailing newlines (trailing-newlines)

------------------------------------------------------------------
Your code has been rated at 9.75/10 (previous run: 9.75/10, +0.00)

Could you also add a screenshot of your conditional controller settings

Can you explain the issue?

The issue: no pump is turning to regulate ph or ec

in the first picture i forgot to set the outputs, the 2.nd is with outputs

If the outputs weren’t set, then it can’t modulate the outputs.

i have set the outputs, in picture 2 ,sorry for the first picture without

What is your current EC and pH?

Enable Log Level: Debug to have the debug log lines appear in the Daemon Log.


here are the ph and ec values,
i have activated log level in conditional modul

2021-05-30 16:40:43,491 - INFO - mycodo.function.bang_bang_728fde22 - Input: 20.977977055037627, output: on, target: 22.0, hyst: 2.0
2021-05-30 16:40:44,408 - INFO - mycodo.function.bang_bang_97a00c8a - Input: 19.4375, output: on, target: 22.0, hyst: 1.0
2021-05-30 16:40:45,121 - INFO - mycodo.function.bang_bang_60d080c9 - Input: 50.1922362990404, output: off, target: 50.0, hyst: 10.0
2021-05-30 16:40:48,324 - INFO - mycodo.function.bang_bang_728fde22 - Input: 20.977977055037627, output: on, target: 22.0, hyst: 2.0
2021-05-30 16:40:49,536 - INFO - mycodo.function.bang_bang_97a00c8a - Input: 19.4375, output: on, target: 22.0, hyst: 1.0
2021-05-30 16:40:50,243 - INFO - mycodo.function.bang_bang_60d080c9 - Input: 50.1922362990404, output: off, target: 50.0, hyst: 10.0
2021-05-30 16:40:53,431 - INFO - mycodo.function.bang_bang_728fde22 - Input: 20.977977055037627, output: on, target: 22.0, hyst: 2.0
2021-05-30 16:40:54,435 - INFO - mycodo.function.bang_bang_97a00c8a - Input: 19.4375, output: on, target: 22.0, hyst: 1.0
2021-05-30 16:40:55,063 - INFO - mycodo.function.bang_bang_60d080c9 - Input: 50.1922362990404, output: off, target: 50.0, hyst: 10.0
2021-05-30 16:40:58,276 - INFO - mycodo.function.bang_bang_728fde22 - Input: 20.92148148904089, output: on, target: 22.0, hyst: 2.0
2021-05-30 16:40:59,572 - INFO - mycodo.function.bang_bang_97a00c8a - Input: 19.4375, output: on, target: 22.0, hyst: 1.0
2021-05-30 16:41:00,141 - INFO - mycodo.function.bang_bang_60d080c9 - Input: 50.21054172456403, output: off, target: 50.0, hyst: 10.0
2021-05-30 16:41:03,363 - INFO - mycodo.function.bang_bang_728fde22 - Input: 20.92148148904089, output: on, target: 22.0, hyst: 2.0
2021-05-30 16:41:04,461 - INFO - mycodo.function.bang_bang_97a00c8a - Input: 19.4375, output: on, target: 22.0, hyst: 1.0
2021-05-30 16:41:05,238 - INFO - mycodo.function.bang_bang_60d080c9 - Input: 50.21054172456403, output: off, target: 50.0, hyst: 10.0
2021-05-30 16:41:08,479 - INFO - mycodo.function.bang_bang_728fde22 - Input: 20.92148148904089, output: on, target: 22.0, hyst: 2.0
2021-05-30 16:41:09,552 - INFO - mycodo.function.bang_bang_97a00c8a - Input: 19.4375, output: on, target: 22.0, hyst: 1.0
2021-05-30 16:41:10,143 - INFO - mycodo.function.bang_bang_60d080c9 - Input: 50.21054172456403, output: off, target: 50.0, hyst: 10.0
2021-05-30 16:41:13,312 - INFO - mycodo.function.bang_bang_728fde22 - Input: 20.916345530241962, output: on, target: 22.0, hyst: 2.0
2021-05-30 16:41:14,410 - INFO - mycodo.function.bang_bang_97a00c8a - Input: 19.4375, output: on, target: 22.0, hyst: 1.0
2021-05-30 16:41:15,262 - INFO - mycodo.function.bang_bang_60d080c9 - Input: 50.20456220521827, output: off, target: 50.0, hyst: 10.0
2021-05-30 16:41:18,412 - INFO - mycodo.function.bang_bang_728fde22 - Input: 20.916345530241962, output: on, target: 22.0, hyst: 2.0
2021-05-30 16:41:19,523 - INFO - mycodo.function.bang_bang_97a00c8a - Input: 19.4375, output: on, target: 22.0, hyst: 1.0
2021-05-30 16:41:20,089 - INFO - mycodo.function.bang_bang_60d080c9 - Input: 50.20456220521827, output: off, target: 50.0, hyst: 10.0
2021-05-30 16:41:22,409 - INFO - mycodo.controllers.controller_conditional_2631d842 - Activated in 101.4 ms
2021-05-30 16:41:23,252 - INFO - mycodo.function.bang_bang_728fde22 - Input: 20.916345530241962, output: on, target: 22.0, hyst: 2.0
2021-05-30 16:41:24,359 - INFO - mycodo.function.bang_bang_97a00c8a - Input: 19.4375, output: on, target: 22.0, hyst: 1.0
2021-05-30 16:41:25,204 - INFO - mycodo.function.bang_bang_60d080c9 - Input: 50.20456220521827, output: off, target: 50.0, hyst: 10.0
2021-05-30 16:41:28,312 - INFO - mycodo.function.bang_bang_728fde22 - Input: 20.962569169909692, output: on, target: 22.0, hyst: 2.0
2021-05-30 16:41:29,528 - INFO - mycodo.function.bang_bang_97a00c8a - Input: 19.4375, output: on, target: 22.0, hyst: 1.0