TL;DR: How can I most reliably determine whether I've logged in to my Mac?
Since updating from Catalina to Monterey my Mac won't stay asleep. I've spent hours on the phone to AppleCare and been through every troubleshooting step I can think of. I have a suspicion that it may be related to either my Caldigit TS3 Plus hub or the external drives attached to it, but I'm still uncertain. In the meantime, I thought perhaps KM could help me out...
I have a smart plug set to turn on with a KM Wake Trigger, and whenever my Mac wakes of its own accord, the plug has turned on. This tells me that KM runs its wake routine without requiring me to log in, so I figured perhaps I could do something like this:
Put my Mac to sleep again IF I don't log in within 20sec.
At least that would mean my Mac would be asleep most of the night. Any advice would be very welcome.
Do an image detect on the top-left corner of the main screen -- if there's an Apple logo then you've unlocked, if there isn't then put the computer back to sleep.
I'm assuming if you unlock it you then do something, not go straight to screensaver!
You've probably been through all this, but does the timestamp on your wake events not give you any clue as to what's causing it? Have you tried turning Power Nap off? Does this happen every night, or just occasionally?
Yes, I know. You don't even imagine all the things I've done to find the culprit. Take it easy. And don't forget, if you just press this red button before you go to bed, you'll save electricity, money and help the climate.
Yep, but then go the next step and use the timestamps from that to search for events around the wake events. Many can be disregarded -- waking up will result in a network event, a calendar sync, etc -- but you might see something that stands out.