What can I do when the power button does not put the macbook to sleep? I have this randomly recurring problem that a short press on the power button will not cause my Mbp mid-2012 to sleep. Besides that, everything is normal, i.e. I can still use it to power off and I can still put the laptop to sleep via any other means. Rebooting always fixes the issue.

Is there any service that one could restart to avoid the reboot?

My os is Sierra 10.12.6.
I would start with resetting the System Management Controller (SMC) to see if that resolves the issue for you.

How to reset the SMC on a mid-2012 MBP


Shut down your MBP
Unplug the power cable from your MBP
For 10 seconds, press and hold at the same time the shiftcontroloption keys (on the left side of the built-in keyboard) and the power button
After 10 seconds let go of all keys and the power button 
Plug in the power cable
Switch your MBP back on with the power button.


Test it for a while and let me know how you go.