Hi,
In the documentation I see that there is the function to get the active valve
active_valve()
optional< size_t > esphome::sprinkler::Sprinkler::active_valve ( )
returns the number of the valve that is currently active, if any. check with 'has_value()'
Definition at line 798 of file sprinkler.cpp.
I would like to use it to display the active valve on a LCD instead of “repeat” the same code for each valve
it.printf(0, 0, "Zone1: %s", id(zone_valve_sw1).state ? "ON" : "OFF");
something like
it.printf(0, 0, "Zone%s", id(esp32_sprinkler_ctrlr)
get(active_valve));
any idea?
regards
nevernind, I think i got it
return id(esp32_sprinkler_ctrlr).active_valve().value_or(NAN)