Each limit switch need to be touched twice and sequence is Z first then followed by X & Y simultaneously.
After first touch it pull back (distance, mm, defined by $27)
If the std value of 1mm pull back dont clear the switch it wont attempt the second touch and enter an alarm state.
$25 = homing speed for first touch
$27 = pull back distance
$26 = homing speed for second touch
If Z dont touch the switch twice => increase $27 to 5 and see if that help to clear the switch properly.