You don't need a magnet lock. There are a variety of keyless options to do what you want to do with battery operated latches.
I've seen this device used to conceal a room behind a shelf in a closet:
But there are plenty that are cheaper if you want. Just search keyless cabinet lock or bluetooth hidden door lock, etc on Amazon/Google, etc