Switches under the bed have a disadvantage of the bed being flexible and the whole mechanical setup being compliant in different amounts at different points on the bed. Really not suitable for generating a detailed heightmap in my opinion, though it would be fine for measuring a single point at the center to define the Z0 point. To do a heightmap ideally you'd have a smart effector or some probe type that doesn't need to physically press into the bed so much.