I agree with Kay

I think just teaching him he has to sit and stay to be let in or out instead of making booby traps

After a while he will probably sit everytime he wants to come in or go out