Sleep function does not work

Solution

Either there is a list or the word 'None' displayed, otherwise the command was not typed correctly.
​Check if any devices is waking up your PC then disable the option that allows them to wake up your PC.
Open Command Prompt and type 'powercfg -devicequery wake_armed' and hit Enter
You will see a list of devices that could wake up your PC.
Go to Device manage locate the device on the list, right-click and select Properties.
Click the Power Management tab and uncheck the box 'Allow this device to wake my computer'.
Click OK .
Repeat these steps for other devices that could wake up your PC.​
 

No, it doesn't have to but it will be best since we want to see what is waking up the PC.

Hit the Windows key + R on the keyboard.
Type CMD and hit the Enter key
On the Command prompt window type: powercfg -lastwake then hit Enter.



 
the following sleep states are available:
Standby (S3)
Hibernate
Hybrid Sleep
Fast Start up

the following sleep states are not available
Standby (S1)
the system firmware does not support this state
Standby (S2)
Standby (S0 Low power idle)



 


You need to try 'powercfg - lastwake' and also 'powercfg -devicewake wake_armed' in Command prompt to find out what is waking up your system.
Also check the task manager for running apps, it could be a program waking up the PC
 
Task Manager say Malware Bytes & browser are the only program running.

powercfg -lastwake >>>>> wake history 0

powercfg -devicewake wake_armed' >>>>Invalid parameters
try /?/ for help
 

Sorry....wrong command
Try this one: POWERCFG -DEVICEQUERY wake_armed
Stop Malwarebytes from running and other unnecessary background processes.


 

There is a list of hardware that are able to wake your system.
You could go to Power management in Device manager and uncheck 'Allow this device to wake your computer.
Also updating these devices drivers might help.

 

...and Windows 8, 7, Vista.

My nephew just told me, he was having the same issue with Logitech keyboard and mouse combo after a Windows update. He tried several Logitech software versions until one worked.