What can I do when the power button does not put the macbook to sleep?
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.