Combining multiple stages in one Conditional Controller would be difficult, since you will need to introduce the use of dates/times, and can also introduce all sorts of issues if you haven’t thoroughly tested your code under various conditions. I would recommend that if you do use one Conditional with multiple different desired EC or nutrient ratios/values, that you merely comment out the ones you don’t need and only have one set uncommented and running. You can then comment out the current set and uncomment the new set when you want to switch to another stage. For example:
# germination stage
ec_ppm = 300
nutrient_a = 1
nutrient_b = 1
nutrient_c = 1
# vegetative stage
# ec_ppm = 1200
# nutrient_a = 1
# nutrient_b = 2
# nutrient_c = 3
And to go to the next stage, change to:
# germination stage
# ec_ppm = 300
# nutrient_a = 1
# nutrient_b = 1
# nutrient_c = 1
# vegetative stage
ec_ppm = 1200
nutrient_a = 1
nutrient_b = 2
nutrient_c = 3
You could also contain these in a dictionary to select the variable set by changing just one variable, for example:
# Select the stage
stage = 1
growth_stages = {
1: { # germination
"ec": 400,
"nutrient_a": 1,
"nutrient_b": 1,
"nutrient_c": 1
},
2: { # vegetative
"ec": 1200,
"nutrient_a": 1,
"nutrient_b": 2,
"nutrient_c": 3
}
}
self.logger.debug(f"Selected growth stage parameters: {growth_stages[stage]}")
Alternatively, the most foolproof way of doing it, which doesn’t require any changing of code (a single typo could cause an error that will prevent the code from running), involves setting up multiple Conditional Controllers, each with a different set of parameters, and merely deactivating all but the one with the desired parameters. I go a bit further and create Execute Actions Functions and add Actions that deactivate all controllers, and one Action to activate the desired controller. This way I can, in one click, change to a different stage and I’m assured there is no possibility of an issue being introduced by a typo or mixing up which needs to be deactivated or activated. These Execute Actions Functions can be labeled like “Germination Stage”, “Flowering Stage”, be placed at the top of the Function page, and be separated by a Spacer Function to organize them separately from the actual Functions that are doing the work.