Not sure where your problem is then as it seems to behave here with your xml when I simulate the input, well except the issue I have here with the active state not changing the LED, that however seems to be an issue with my computer here of which I have not found the answer yet.
So when I use your xml I simulated the Z home switch and pressed the Ref All button, the Z DRO started moving and then when I presses the switch it reversed until I released the switch and then it stopped and set home.
Hood