I haven't tried this but it should work. Set up one upper switch and one lower switch so they both trigger the "Digitize" input. For your "UP" routine, do something like G31 Z4.000 and for your "DOWN" routine, do something like G31 Z-4.000. I'm assuming a negative number drives your Z down.
Create two buttons and put each routine in it's own button, like....
code "G31 Z-4.000"
When the axis hits the switch it will stop. If you want to do something else after it stops, add that code after the G31.
Just curious....Are you trying to make a floating head work? Can't figure out why you'd want a switch on the bottom of the Z axis travel....Unless you're using it as a lower limit. We use an upper travel limit and a floating head with the G31 code on the floating head.