How to identify processes that prevent a mac from sleeping
From Tech-Wiki
Run the following Terminal command
pmset -g assertions
The 1st section of output shows the status of kernel assertions. If either PreventSystemSleep or PreventUserIdleSystemSleep have a status of 1 then the mac will not sleep.
In the 2nd section of output the processes that own the assertions are shown(process id then bundle id).
To identify the process:
ps up <pid>