When you notice your motivation dying, you have to seek out the subtle cause.
There are times when it seems like you are not able to get anything done. You try to do other things, wasting time instead of getting the main task done.
I have been in this situation many times. What I do is a simple change of environment.
Ideally, I would love to move to another space. From office, maybe to a cafe or a library. But there are always challenge of having good internet, power and most importantly good coffee. So if this is the case, I simply move for one seat to another. This change of seat give me a whole of perspective, which helps me trigger back the “working” mode.
I strongly suggest you to try. Especially when you find yourself not getting anything done.