A switch can be turned into a diode with appropriate control circuitry. Even for electricity where diodes exists, active rectification is a thing as in certain situations it can provide higher efficiency or signal accuracy compared to plain silicon diodes.
Pretty sure that would violate the second principle of thermodynamics.