Recently I was asked if there was a way you can find out what is preventing a mac from sleeping, my friends MacBook had stopped going to sleep. I told him to use the pmset command. Pmset is a way you can read and change many of your power management settings for your device.
On this occasion if you use the -g flag it shows you the current settings, this is from my machine below.
Last login: Mon Nov 7 20:02:37 on console