Box with thread or two 4x4 mm magnets.
Be careful with electricity !!! It would probably be appropriate to use silicone, but I don't have it at the moment.
When modeling, I used the switch model from the link.
https://www.thingiverse.com/thing:3223834
The author marked this model as their own original creation.