I’d just throw an analog min/max thermometer in there and investigate if the max temp goes above 40F, sounds a lot easier than adding a temp probe and door switch to a residential refrigerator.
There is already a door switch in all the refrigerators I have used. It controls the light (at least I think it does, I have never seen the light go off:)
Close the door very slowly. If you do it right, you'll see the light turn off.
Or, y'know, press the switch yourself.
Oh yeah, I forgot about the built in door switch, good call XD