Perhaps tie into bluetooth instead. If your Watch or iPhone goes out of range, lock the machine.
EDIT: Confirmed. This works. In a few minutes, I was able to set it up so that if my watch moves about a meter away from the mac, it'll lock the screen. It supports any Bluetooth LE device.
(no relation, just a happy customer)