@Windowser If you have an IR probe, you'll achieve much better bed levelling with that than using dual endstops. See https://duet3d.dozuki.com/Wiki/Bed_levelling_using_multiple_independent_Z_motors
If you want to continue to use endstops, there's a few problems with your config and homez. Also see https://duet3d.dozuki.com/Guide/Independent+Z+motors+and+endstop+switches/18
; Motor remapping for dual Z
M584 X0 Y1 Z2:4 U4 E3 P3 ; Driver 0 For X, 1 for Y, Z=2:4 U=4, Extruder 3
This command must be BEFORE the motor settings. Move it up to before the 'Drives' section. Do this whatever method you choose.
M350 X16 Y16 Z16:16 U16 E16 I1 ; Configure microstepping with interpolation
Change 'Z16:16' to 'Z16'. The firmware ignores the second value.
M587 S"FDMDEV" P"XXXXXXXXXXXXXXXXXXXXX" ; Configure access point. You can delete this line once connected
Delete this line. Continually rewriting the SSID will kill the flash memory of the Wifi module eventually.
In homez.g:
M584 Z2 ; Split Z into 2 (Z+U)
You need to make the U axis visible with P4, so it can be homed. Best to set this to M584 Z2 U4 P4.
M584 Z2:3 ; Join U to Z again (pay attention to drive numbers used)
In your config.g you mapped Z to Z2:4 and the extruder is mapped to driver 3. Change to Z2:4. Also hide U axis with P3.
The homing moves are a bit strange in your homez.g. I'd expect the bed to move negatively (up towards the nozzle) the full distance (Z480), stopping if it hits an endstop, then back away, and then move to the endstop a second time more slowly. eg
G1 Z-490 U-490 F2000 S1 ; Move bed up full range. S1 to stop if endstop is triggered
G1 Z2 U2 F600 S2 ; Move bed down 2mm (S2 is not really needed)
G1 Z5 U5 F100 S1 ; Move bed up slowly 5mm , stopping at the homing switch
G1 Z-5 F3000 ; Move back again 5mm in the -Z direction
This last move should be positive, not negative, to move the bed 5mm away from the nozzle.
Ian