What I did (decades ago) was realize that when I was working from home, I needed to treat it the same as working in an office. What that meant was: I need a room that is exclusively "the office". When I'm in there, I'm working. When I'm not working, I'm not in there. And everyone else in the household has to adhere to one rule -- if my office door is closed, they cannot disturb me for any reason other than an actual emergency, just like if I were in an office outside of out home.