Bought a new computer a couple months ago and its nagged me since, that about half the time after the machine goes to sleep, it immediately wakes up. Windows 10. I've "solved" this so far, by holding the power button down until power is removed and that makes the machine quiet and without lights, but a better answer is to figure out why this thing is waking up immediately after sleeping. The diagnosis and fix are detailed below.
Machine is an IBuyPower gaming computer, Windows 10 64-bit. Comes with a very good Nvidia graphics card and big quiet fans, so winner. Generally a good box, the machine has a bad habit of waking up immediately after it goes to sleep and that's a headache.
Click on Start / Power / Sleep and the computer immediately wakes. This is normally followed by me pressing the power button for 5 seconds to tell the power supply to cut power to the machine and that generally makes the computer quiet, but this is not the right solution or behavior.
Took some time today to debug it and the problem is now solved.
Start / Settings / Power & Sleep / Additional power settings (over on the right side) / Choose what the power buttons do
And survey says that the power buttons are configured in Windows to tell the computer to sleep, okay, good.
Start / cmd (run as administrator). It runs, then elevated power, run eventvwr.msc
This launches Microsoft Management Console, event viewer. Scroll to System tab and scroll back in time to find out when and why the computer most recently woke from sleep. Answer in this case is that the machine went to sleep at 23:57 UTC and woke up 6 minutes and 3 seconds later. Odd, I thought it was 3 seconds total. No matter, the time of this is just a curiosity, the real problem is that the event viewer says that it DOES NOT KNOW why the machine woke up.
Command line tools can ask the system the same question and here, get a more helpful answer
Wake History Count - 1
Wake History 
Wake Source Count - 1
Wake Source 
Instance Path: PCI\VEN_10EC&DEV_8168&SUBSYS_E0001458&REV_16\01000000684CE00000
Friendly Name: Realtek Gaming GbE Family Controller
Description: Realtek Gaming GbE Family Controller
OKAY - We have a hint. Took me a while to figure out that "Gaming" in this case was just there to confuse matters, the real key is the "GbE", which means Gigabit Ethernet. Off to Device Manager to find this device and see if it is configured as a "wake source" for power management.
Start / devmgmt.msc (run as administrator).
Locate network adapters in Device Manager.
Find the Realtek Gaming GbE Family Controller, select it's properties
And success! Clear the checkbox for "Allow this device to wake computer" and the problem is solved. If I were an enterprise, I might have some use for wake on LAN or similar, but here, I do not want the network adapter to be able to wake my machine and certainly don't want it to in this case as it appears the Realtek Gigabit Ethernet is waking the computer for just about no reason at all.
I hope this helps other people experiencing the same.