Mid-2010 21.5" iMac wouldn't go to sleep/remain asleep. Finally got it to go to sleep using PleaseSleep (Donationware). You can set it up to keep the iMac awake during the day if particular apps are running. Don't know if it'll work for you, but it certainly did for me.