Long story short: My Mac doesn’t auto-sleep because of VLC being paused (not stopped) in the BG. So I have a custom Keyboard Maestro macro that does some checking to see if everything else has been idle for X period of time, and IF yes, it uses the Put Computer to Sleep action you mentioned.
So this is really about Keyboard Maestro being able to continue doing that with the lock screen ON, which I plan on invoking manually.
But my first step was to reduce the action down to just the periodic check trigger + Put Computer to Sleep and it still didn't work. (Hence the question)
Does this make more sense?
It sounds like we're going the same direction but on different tracks
I believe that I've got this issue resolved. In tinkering with an AppleScript (the basis of which I found on StackExchange) I found that when placed at the beginning of the macro it will successfully unlock the screen.
Note that you should run the macro manually a couple of times before relying on the script because you may have to give permission to a couple of services in the Security & Privacy Preferences pane to allow the script to control it. Replace the "YourPasswordHere" with the password that unlocks your screen/Mac:
This will unlock the Mac and allow you to proceed with the remainder of the automation as programmed into KM.