If no keyboard input for 1 hour, make Mac to sleep

My MBP some time can't sleep .
So I want use KeyboardMeastro to set up that if No keyboard input or mouse move for 1 hour, than force mac to sleep, Anyone knows how to do that? Cause KM seems doesn't has function detect keyboard or mouse input.
Thank you

May I propose another approach: Find out what is preventing your Mac from sleep.

There are some helper tools that will assist you with that:

Activity Monitor

  1. Launch Activity Monitor (/Applications/Utilities/Activity Monitor.app).
  2. Click the Energy tab.
  3. Sort by the Preventing Sleep column.
    • If that column is not visible then activate it from View > Columns


This is a little menu bar app you can download from the Mac App Store ($0.99).

Its main purpose is to prevent the Mac from sleeping, but it also shows you any processes that currently are preventing your Mac from sleeping. It might show you processes that are not shown in Activity Monitor:


Open the Terminal and type pmset -g assertions followed by a Return.

You get a similar output as with Wimoweh, but harder to read and more detailed.