Grouping of switches

I use an ESP32 to control my irrigation system. Pretty simple set up: a relay board and a 24V power supply to operate magnetic valves. To optimize energy usage I would now like to switch on the power supply with a different relay only if at least one of the magnetic valves is activated.

In HA I would group the switches for the valves, and activate the relay for the power supply if the group is on / deactivate if the group is off, probably with 60 seconds of wait before switch off to avoid unnecessary cycles between valves opening and closing.

Is there a way to do this directly in ESPHOME as to avoid depending on WiFi / HA? From the documentation the only way apparent to me would be an automation on each switch that checks all other switches as a condition?

Does this help? Power Supply Component — ESPHome

Looks promising - bit more complex to implement, but what I was looking for. Thanks for the tip, I will try it out!