I was having the same problem, something keeping the iMac from going to sleep, display sleeps fine but hard disk keeps spinning and mouse LED stays on. Apple support offered some suggestions in the following post:
OS X El Capitan: If your Mac won’t go to or stay in sleep
I tried everything they suggested: Checked system’s sleep settings; system’s network access settings; system’s Bluetooth settings; system’s sharing preferences; Unexpected keyboard presses or mouse and trackpad clicks; Apps that access a disk; Spotlight indexing; Connected storage and devices, etc. I even went through the trouble of resetting SMC, PRAM, and deleting the power management plist. Nothing. Then I tried the ultimate trick, a clean install of OS X but to no avail. I even made sure the clean install was done without restoring the user's preference files so that system settings would revert to default. Then, reading this post I discovered that many people were having success by resetting the printing system which got me thinking that maybe, just maybe, there was a print job stuck in the printer's queue that was keeping the computer from sleeping because I normally keep my printer off. Sure enough, once the stuck print job was cancelled problem resolved !!! To check the status of the print queue: System Preferences > Printers and Scanners > Open Print Queue
Now, looking at the statistics in this post, most people were able to resolve this issue by resetting the print system, however, I suspect that in many cases the original issue may have been a stuck print job which probably gets cleared by resetting the print system. NOW HOW COULD APPLE MISS THIS LITTLE BUT IMPORTANT CHECK IN THEIR SUGGESTIONS ABOVE !?! It is kind of stupid if you ask me, that a stuck print job should keep a computer from sleeping for days, weeks, months, years unless it's cleared ! NOT EVEN A CLEAN INSTALL OF THE OS COULD CHANGE THAT !!! I mean comm'on programmers, if the job is stuck for DAYS why isn't the OS smart enough to figure out that it's no longer needed, cancel the print job automatically and go back to normal operation. UNBELIEVABLE !!! Also, APPLE PROGRAMMERS: if you're monitoring these posts, please add a print status indicator to the menu bar so that we know this is happening. Also, to anyone else reading through this post, if I can offer some advice, turn of Spotlight indexing because it will consume clock cycles like it's going out of style and will also keep your computer from sleeping, all for so little benefit in return. Won't go into details of how that's done here as there are other posts on the subject. In my opinion Spotlight is one of the dumbest and most useless features ever implemented by Apple in their computers.
And don't feel bad if this happened to you also, I've been using apple computers since 1986.