I built a keypad for my MPCNC that runs Octoprint. This connects to my tablet via an OTG cable. I have a pro micro inside the enclosure and am using mechanical keyboard switches to program each input as a keyboard command (Printoid Premium supports keyboard commands). I can't provide a whole lot of technical support on how to do this, you kind of need to have some arduino experience (very basic) to wire everything up. However, I just wanted to share my files in case someone wanted to build something like this.
The Fusion file is included if you want to modify it for your needs.