A Windows 7 Media PC (HTPC) with Plex and Media Portal TV servers installed never enters sleep on its own. It can be put to sleep manually via Start Menu (if no TV is being recorded or streamed), but it never enters sleep automatically according to the Windows Power Plan sleep schedule.
powercfg -requests and powercfg -devicequery wake_armed commands weren't giving any clues, digging into Windows Power Plan advanced settings was also not much of a help. My suspicion was on Pex or Media Portal servers. After a bit of experimenting, I found that the issue doesn't occur if Media Portal TVService is not running. After some more digging through the Media Portal TV Server Configuration utility, I narrowed down the issue to DVB EPG service, specifically EPG grabbing while idle.
With "EPG grabbing while idle" option disabled, the computer would enter sleep as expected. I didn't want to leave this disabled though, as EPG would likely get out of date if nobody was watching TV via Media Portal for a while. After some browsing through Media Portal forums, I found that my DVB EPG settings were not configured properly. My TV EPG grabber was set up for all TV and Radio channels, which is likely to cause PC sleep issues. It appears that it is enough to set up EPG grabbing on one 24/7 channel and this is supposed to grab EPG to all channels (at least in the UK for the terrestrial Freeview service).
Here is how I set it up according to recommendations I found in Media Portal forums. This fixes the sleep issue and still allows grabbing EPG while the PC is idle.
Windows 7 Pro
Media Portal 1.27