I've worked from home for years. The trick for me is to have a schedule and stick to it. I also always get dressed for work and have regular breaks. The first few months I tried it, I practically burned out. Goofing off, no schedule, getting depressed, staying in pajamas then coding like mad at night. It turned into a blurry nightmare and I feel for all the people going through that.
At this time, my husband and brother are here working from home and I'm so used to being alone... they're throwing me off my schedule with their TVs, conference calls and random interruptions. I kinda hate it.