So this is what it looks like mostly constructed.
If something is worth doing, it's worth OVERDOING, right?!
I decided I didn't want a fat transformer for the pool lights, especially since I bought a colour changing LED bulb, so I went with the MeanWell DIN-mounted converter. Unfortunately, it is quite tall, so the 8-way box that I originally got from AliExpress was too shallow, and I had to find another deeper one. Of course, the 8-way also didn't have enough place for the Sonoff AND a double-pole isolator anyway, so I replaced it with a 12-way instead.
The MeanWell being tall, and the Sonoff being shallow made for some interesting arrangements with regards to the DIN rail itself. I ended up with 3 segments of rail, one right at the back with the MeanWell mounted on that, another stretching up to the MeanWell that the double pole isolator is mounted on, and finally a last piece that the Sonoff is mounted on. I used stainless steel bolts, nuts and washers to construct standoffs to get the separation of the rails as I wanted them.
You can see the 3 wires leading to a JST socket. This is for the flow rate sensor. I soldered a power wire to the 5V side of the 3.3v regulator, since the flow sensor only operates on 5-24V, and then put in a level converter to map the signal back to 3.3v, on the SDA pin (GPIO2) on the programming header.
I'm using the Tasmota firmware to switch the relays, and have configured it to operate a counter on GPIO2. It's all reporting back to a Mosquitto server running on my router (OpenWRT).
Once I get reliable results, the next step will then be to set up Node Red or similar to manage it all.