I just purchased Mini M4 and it seems it is not sleeping even if I manually put it into the sleep mode. Screen is off but thats it. When I wake it up in the morning my all ssh sessions are still alive:/ I encounter several "disk was not ejected properly" messages as I suspect disks go to sleep, but mini is not:/ Poor implementation from Apple. If I put mac to sleep, I want it to sleep and not do something in the background:/
Have you turned off “Wake for network access.”? Also you say you just bought the Mac. It could be Spotlight indexing keeping it awake. "Spotlight indexing: If Spotlight is indexing your hard disk, your Mac won’t go to sleep."
If your Mac sleeps or wakes unexpectedly
Check your sleep settings, sharing settings, system activity, and other possible causes.
support.apple.com