I see you’ve solved your problem, but since reading this post I thought about trying to code an external to do the job. Attached is a mac external that detects sleep and wake conditions. I’ve been to sleep and woken a few times and everything *seems* ok.
the source is included but may cause some distress?:)