YMMV but my trick for Facebook was a hard commit to "I'm going to take 2 weeks off". Cold Turkey with a boundary. I think I check it once for five minutes every month or two now.
HN is trickier because I don't have to login first to see it. When I start to think Im on it too much, I delete it from my password manager and don't supply an email. (Sorry, I know this is annoying to them what run this site)
Another useful thing is to generally keep a "don't respond to first level replies" policy. Keeps you in discussions but out of knee-jerk responses. Might seem rude but it keeps you sane.