Brown and black to 1 and 2. But as to 3 and 4 it all depends on if 24 volt or 230 volt control. Boilers have 4 ways to control them.
1) Return water temperature.
2) 230 volt AC on/off
3) Extra low voltage on/off normally around 24 volt.
4) Analogue control normally 0 - 48 volt
Some boilers have all options, some only one. But even the boiler make and model often does not help, it could be either 2 or 3, but we have no idea which. If 230 volt there is a chance the grey can be connected to neutral.
Try with a neon screwdriver, not a good test, but if it lights then you have a chance, if not then likely 24 volt.
As far as I am aware the only wall thermostat with wifi that is 2 wire only is the Nest E.