sleepwatcher

Install command:
brew install sleepwatcher

Monitors sleep, wakeup, and idleness of a Mac

https://www.bernhard-baehr.de/

/api/formula/sleepwatcher.json (JSON API)

Formula code on GitHub

Bottle (binary package) installation support provided for macOS releases:

Intel big sur
catalina
mojave
high sierra
sierra
Apple Silicon big sur

Current versions:

stable 2.2.1
For SleepWatcher to work, you will need to read the following:

    $(brew --prefix)/Cellar/sleepwatcher/2.2.1/ReadMe.rtf

Ignore information about installing the binary and man page,
but read information regarding setup of the launchd files which
are installed here:

    

These are the examples provided by the author.

Analytics:

Installs (30 days)
sleepwatcher 332
Installs on Request (30 days)
sleepwatcher 317
Build Errors (30 days)
sleepwatcher 0
Installs (90 days)
sleepwatcher 1,004
Installs on Request (90 days)
sleepwatcher 955
Installs (365 days)
sleepwatcher 3,486
Installs on Request (365 days)
sleepwatcher 3,339
Fork me on GitHub