Write software to ship. Even the "farting around" stuff. Document, test, READMEs, etc.
Seriously. It really helps to power through the "ho-hums."
I have found that the reward of a finished product, at the end, works well as a "carrot" for me.
Also, as has been mentioned elsewhere, establishing habit is, in my opinion, essential.
"We are what we repeatedly do. Excellence, then is not an act, but a habit."
- Somewhat incorrectly attributed to Aristotle