Thanks for tagging me @JDRoberts!
@Kal20, here’s what I did for a deadbolt. If you have room inside the lock, like had, a microswitch could be placed and configured to have it trip. I literally used a toothpick glued to the barrel and when it rotated around it closed the switch: