I've found that repeating a little mantra of what to expect of myself exactly at that moment of switching helps. For me that moment is getting out of the car, hungry and with a full head, after a long commute. Diving head first into family life with small children is hard, but they deserve my fullest attention before bed time even before my own needs (food, rest, possibly work some more). Just breathing and repeating that works for me. (Apologies if this goes too far into the spiritual.)
Erm, I would call spiritual something different ...
What you do, is just helpful, applied psychology ;)
edit: spiritual, I would more call, praying to whomever, to fill you with love, before going into your family life ... which can also work, wheter for psychological or divine reasons ...