What keeps waking my Mac up from sleep?

My Mac constantly wakes itself up from sleep for apparently no reason. Middle of the night, middle of that day, it just can't stay asleep. Why? I ran pmset with the following results:

[redacted]:~ [redacted]$  pmset -g assertions
2015-01-26 08:27:29 -0800 
Assertion status system-wide:
   BackgroundTask                 0
   ApplePushServiceTask           0
   UserIsActive                   1
   PreventUserIdleDisplaySleep    0
   PreventSystemSleep             0
   ExternalMedia                  1
   PreventUserIdleSystemSleep     0
   NetworkClientActive            0
Listed by owning process:
   pid 72(hidd): [0x0000b0bc000906ce] 18:03:19 UserIsActive named: "com.apple.iohideventsystem.queue.tickle" 
   pid 26(powerd): [0x000000230008012c] 43:45:02 ExternalMedia named: "com.apple.powermanagement.externalmediamounted" 
Kernel Assertions: 0x10c=USB,BT-HID,MAGICWAKE
   id=501  level=255 0x4=USB mod=1/24/15, 12:48 PM description=EHC1 owner=AppleUSBEHCI
   id=503  level=255 0x100=MAGICWAKE mod=1/26/15, 6:47 AM description=en0 owner=en0
   id=504  level=255 0x8=BT-HID mod=12/31/69, 4:00 PM description=com.apple.driver.IOBluetoothHIDDriver owner=BNBTrackpadDevice
   id=506  level=255 0x8=BT-HID mod=12/31/69, 4:00 PM description=com.apple.driver.IOBluetoothHIDDriver owner=AppleBluetoothHIDKeyboard

Solution 1:

As for what:

The message Kernel Assertions: 0x10c=USB,BT-HID,MAGICWAKE says it.

Also the ExternalMedia is set to wake it up over your USBbluetooth. connection.

So you have a device (BT keyboard) that does that.

As for why:

You BT track pad wakes up (do you have a Cat?) other BT devices interference, low battery... see this for more.

To test do "Allow Bluetooth devices to wake this computer" OFF.

If you have the Magicwake app installed, remove it.