The advice about making sure the family knows work comes first during your work hours is good. Make it clear that if you come out to stretch your legs and chat for 5 minutes doesn't mean you are done for the day or can take an hour to mess around, and make sure if you are in the office, no one should bother you unless its an emergency.
The biggest thing for me was setting goals based on accomplishments instead of time. You WILL spend time getting distracted by family etc or just taking advantage of the fact that you can go for a nice walk at 3:00pm (if you are allowed to be offline). You will also end up spending time on evenings and weekends working because if you think if something at 11:00pm on a Saturday you are much more likely to do it right then then wait until your "at work" Monday.
Either way, its really really hard to accurately track your time when working from home. Some people seem to like a rigid schedule, but as a programmer I much prefer flexibility. Some people rigorously track their time, but that gets annoying. My solution is to set myself daily / weekly tasks though should be reasonable if I worked ~7 hours day for 5 days and measure myself more on that then on trying to figure out exactly how much time I spent in my seat. You still have to feel it out a bit, but it means you don't have to sweat too much about the fact that work and home will blur together a bit.