After experimenting with the Rule Machine version linked above by BrianP, which can work ok once you get it setup, I wrote this addon to give a better pin/keypad experience on the dashboards:
In addition to setting HSM or modes, you can create custom triggers for anything (RM/webcore/etc) that can require a pin, or not, and you can use 'lock code manager' to help manage multiple pins/codes on the virtual keypad device. You can then add your configured keypad to any other dashboards you want to include it on, or have custom virtual keypads for different dashboards/user groups.