I have my 3D printer in a wardrobe and I have designed various holders for the cheap hygrometers from Amazon. All you have to do is measure the lock diameter in your cupboard and then print the appropriate file.
If it prints like in the picture so that the holder is in position, then you only need a little support material
Hygrometer Link:
The author marked this model as their own original creation.