When you first wake up you don’t have full control of your reasoning faculties, even if it seems like you do.
I hate it when I do immoral things when I am groggy because throughout the whole day the thought that I may have committed a grave sin is always in the back of my mind. But rest assured that thought will go away.
It is impossible to commit a mortal sin while groggy. I think it is possible to commit a venial sin though.
I am really pleased when I am extremely groggy and I still am able to resist really bad temptations.
Also for future reference. One does not have to “finish” to commit a mortal sin of masturbation:
It says nothing about finishing. I would assume you didn’t know this so don’t worry. You were also in a groggy state. So it was at most a venial sin.
If you are having problems with masturbation the following website may help:
saint-mike.org/spcdc/SWPrayers/default.asp
It has many helpful prayers that are designed for people that are engaged in some sort of spiritual strugle.
Peace of Jesus Christ be with you.