Wake from Sleep as an Action

I note that while KM has a Put Computer to Sleep action, the only wake action is “Wake Screen”.

I assume that there isn’t a way to wake the computer - not just the screen, as an action? I would like to automatically wake the Mac with the time being the trigger.

When I tried using the system Energy Saver preferences to schedule wake and sleep, it wouldn’t work consistently, so I thought about using KM instead.

So, is there a way to Wake from sleep?

1 Like

Hey Andrew,

Nope. Not with KM.

Your options are the Energy Saver System-Prefs and the shell command pmset (man pmset in the Terminal).

There are some front-end utilities for pmset, but I think they all cost money.

-Chris

1 Like

Thanks for the reply. I will have to try the energy saver prefs once again.

I use the Energy Saver Systems Preference Schedule item to wake up the computer (in the wee hours) so a scheduled backup will run. If the computer is shut down and/or restarted, that seems to get suppressed. It still shows in the panel but doesn’t actually work (backups didn’t run). I un-check and then re-check the “Start up or wake” item and that seems to get things working again.

To avoid having to remember this, one can create an Applescript app (which runs a one-line Bash script) place it in one’s Login Items folder, but only if one has sudo priveleges. The Applescript is

do shell script "/bin/bash -c echo 'YourPassword' | sudo -S pmset repeat wakeorpoweron MTWRFSU 01:01:00"

Since your password is in the script, it’s wise to make it read-execute permission for its owner and no other privileges. It still may be a security risk, per

Hello CC, it's me again !

I wanted to implement your suggestion but I am confused by the many settings of pmset

If I use it as below using the shell script action, what should I write inside the box simply to tell my Imac:

1- wake up !

2- go to sleep !

Is it OK to have a global macro with a time of day trigger which would start with the pmset shell script below, or does the computer have to be awake for the time of day trigger to work ?

thanks very much !

image

Hey @ronald,

Keyboard Maestro has a Put Computer to Sleep action.

I've never actually used pmset for this, so I can't speak from experience.

However – this reference looks like it explains things well enough.

http://www.macos.utah.edu/documentation/administration/pmset.html

-Chris

2 Likes

thanks very much for your post and the excellent reference.