This is inspired by Zenon's https://www.thingiverse.com/thing:3082051 . I moved the spring inside the lever and designed for endstop switches.
Additional parts needed:
2 micro switches with roller lever, e.g. Omrom SS-5GL2
screws and nuts to fix micro switches, I used 4x M2x10
1 screw M3x20
1 screw M2.5x15 or longer with countersink head
2 washers, 6mm diameter
75mm piece of 3mm diameter spring, 0.4mm wire.
If printing the pegs on the lever gives you troube, you can use the alternate lever design with holes instead and insert M3 set screws instead.
Doesn't Matter PETG, or PLA
Print at 0.2mm layer height. Print the lever so that the pegs are horizontal to avoid them snapping off at layer boundaries
Step 1 - Insert M3 screw into the right case and hook on the spring
Bend over the last turn of the spring 90° so that it can be hooked over the M3 screw.
Insert the M3 screw into main part of the case, making sure not to insert it the full width of the case for now. The hole should be tight enough so that the screw cuts its own thread into the plastic.
Put on one of the washers over the screw and hook on the spring. Adjust the spring to sit about 4mm above the washer.
Step 2 - Insert the spring into the lever and thread the slot in the lever over the M3 screw
Thread the free end of the spring into the bore along the lever through the slot.
Thread the slot over the M3 screw. The lever should click into position. Make sure the lever can rotate freely around the screw and can move freely along the slot. If anything sticks, adjust the height of the spring on the M3 screw.
Step 3 - Thread the M2.5 screw into the free end of the spring
Position the lever in one of the detents and push it all the way in. Insert the m2.5 screw into the hole at the end of the lever and turn the screw a few turns to engage the spring. Then pull out the screw, stretching the spring. grab the spring and screw the M2.5 screw almost all the way in. Do not tighten the screw in the spring. If you tighten the screw too much, it will be almost impossible to remove it from the spring.
Allow the spring to pull the screw all the way into lever.
Step 4 - Position the micro switches
Position the micro switches so that they are fully engaged when the lever is in the repsective detent. The exact positioning depends on the type of switches you are using. Drill the necessary holes and mount the switches with screws.
Step 5 - Finish
Put the 2nd washer over the M3 screw, then snap the cover plate into place. Screw in the M3 screw in all the way, through the hole in the cover plate. This is easier if the lever is in a detent because of the lower spring tension pulling on the screw.