There’s a guy who did it with Tasker and a Satechi Bluetooth button, the principle should be the same.