Hi,
I’m playing with the sprinkler control, and I would like to sum up the total value of run_dutation across the different valves,
I started with this code
lambda: "return id(esp32_sprinkler_ctrlr).valve_run_duration(0) / 60+id(esp32_sprinkler_ctrlr).valve_run_duration(1) / 60;"
but I would like to use a “smarter” to make the code dynamic and automatically add valve base on the valve list. If I add or remove valve, the code should adjust the sum to reflect the change
In fact I should do something like
valves = count_of_valve
for X in valves
valve_time = id(esp32_sprinkler_ctrlr).valve_run_duration(X)
total_time = total_time + valve_time
return total_time
how I can properly “translate” that?
regards