Just curious. I see the auto flush toilets and urinals (red blinky light where the flush handle used to be) quite a bit nowadays. How does the auto flush mechanism get its power? Is there just a battery or two in there? I don‘t see any electric running to them.
Batteries it is, those red blinky lights don't ask for much energy.
There is also the effect that the IR needs to reflect and be picked up again. the body in the stall blocks the transmission, then it triggers the flush when the ray gets through again. It can be very disconcerting to little ones who are not used to it and not big enough to keep it from flushing at the wrong time.
The system is typically a low voltage about 12 volts ac, that runs the sensor and the flush solenoid. The wires are run in the decorative trim to a low voltage connection point much the same as a doorbell.