The modern 3 port mid position valve with the colours white, grey, orange, blue and green. are wired as follows.
green is earth. blue is neutral.
programmer supplies room stat and switched live from room stat leads to the 'white' on valve. This gets the valve to mid point.
When HW is satisfied or not switched on then the grey is made live, this comes from two sources. The satisfied terminal of the cylinder stat and also the HW OFF terminal of the programmer. If the grey is made live it takes over from the white at mid point and drives valve to CH only position.
When this occurs it triggers a microswitch and makes the orange live and this is used to fire the boiler, because the primary method of firing the boiler through the cylinder stat is no longer there.