Lock Screen using terminal? Osascript is preventing keystrokes
I found an answer.

The Lock Screen app on Github does exactly what I wanted to do.  So, by downloading it and adding this to my script, I can lock my monitor remotely:

run application "Lock Screen"


Edit: It seems the application runs the following script:

activate application "SystemUIServer"
tell application "System Events"
    tell process "SystemUIServer" to keystroke "q" using {command down, control down}
end tell


Adding that to my applescript still gives me an osascript error, but triggering the Lock Screen app using applescript works perfectly for my needs.

This makes me happy!

I have a remote at my door that I programmed to turn my lights on when I click the ON button, and when I click OFF, it turns my lights off, makes sure various smart devices are off, and it locks my Mac's monitor.

If I'm headed out the door, OFF makes sure everything is off and the Mac's monitor is locked.

Love it!