Sober homes — places where people can live after residential substance use treatment to support the early stages of sobriety — have a somewhat sketchy reputation in Massachusetts.

After years of complaints and lawsuits alleging that some of the homes are unsafe and anything but sober, the state is taking steps to more closely monitor sober homes. The Massachusetts Department of Public Health has started a voluntary certification process for sober homes.

During a recent visit to the Kelly House in Wakefield -- one of the estimated 300 to 400 sober homes operating in the state -- the residents were attending their weekly house meeting in the basement.

Kelly House owner Rich Winant asked the 29 men there to share their experiences from the past week. "Positives for the week," he said, "either recovery-related, family-related or job-related."

One of the men told the group he was finally able to buy his own car and the room erupted in applause. The camaraderie was evident.

The meetings are a requirement for the men living at Kelly House, who range in age from 18 to 60. They also have to undergo drug and alcohol testing and regularly attend meetings based on the 12 steps of Alcoholics Anonymous. Rent is $150 a week.

Sober homes are supposed to be safe places for newly sober people — some who are there voluntarily, some ordered by the courts.

"What we provide is a safe, supportive, positive environment where the goal is to make connections, to become part of the community in the house, and you learn from each other," Winant said. "It's a disease of isolation, so you're in a house together with other people, hopefully on the same path."

But Winant has heard that many of the sober homes in Massachusetts are overcrowded, in disrepair and, most importantly, do not really crack down and honestly test for substance use.

"They may say that they're testing, but that may lend itself to the house manager saying, 'Give me $50 and I'll say that you passed,' " Winant said. "There are homes that are a complete mess, where a guy is putting in as many beds as possible and charging people rent."

Because of that reputation, about a dozen sober home operators formed the Massachusetts Association for Sober Housing eight years ago to try to set standards for the unregulated industry. Winant is now its president.

"Tomorrow you and I could open a sober house and do whatever we want," Winant said of the current landscape.

Some people who've lived in sober homes have horror stories. Thirty-three-year-old Jesse Centamore has been sober for the past four and a half years and now runs two sober homes operated by the treatment center Gosnold on Cape Cod.

"I've seen and lived in houses where literally as long as I was giving them a check every week, my actions and behaviors were overlooked, they didn't really care, which was absolutely counterproductive for someone like myself who was in early recovery," he said. "I needed that support, that structure, that guidance — otherwise my behaviors probably won't really change."

Centamore says he relies on an informal word-of-mouth network about which houses are reputable.

But with the opioid crisis increasing demand for such housing, state health officials have contracted with a national group to develop guidelines to certify the homes.

Rhonda Mann, a spokeswoman for the Executive Office of Health and Human Services, says the group the National Alliance for Recovery Residences will train Massachusetts providers how to certify the homes.

"This way we at least have a general set of guidelines around this process and we as a state can keep track of where those homes are and be a good referral source for people who are looking for that sort of housing," Mann said.

The certification is voluntary, but if a home is not certified, the courts cannot refer people to live there.

But the question remains: Why haven't these homes been regulated before?

Mann says because the homes do not provide formal treatment, they're legally classified as privately owned lodging houses for recovering substance users. Under federal law, recovering substance users are considered disabled, so imposing requirements on sober houses could be considered discriminatory. The state can certify the homes, though, and make it voluntary.

What's also complicated is that it's not exactly clear how long someone should stay in sober living.

Sober home operators estimate that the average length of a sober house stay is about a year. But Ray Tamasi, president of the treatment center Gosnold on Cape Cod, says that depends on the individual.

"We tell patients, 'We want to be here to manage your illness over the course of your lifetime, and hopefully that's in increasingly less-intensive environments because we want to get you back into life,' " Tamasi said. "Now that's not to say some people shouldn't be in three months, six months ... some people in late stages of this condition probably need to be in places like sober living forever."

If someone is looking for a sober living, what should they watch out for? Winant, of the Kelly House, advises: Ask questions, make sure there is on-site 24-hour management, and be wary of promises.

"There are houses out there promising parents, 'We can get your kids clean.' I don't delude myself. I tell parents every day, 'I can't get your kid clean and I can't keep them clean. That's up to them,' " Winant said.

State health officials plan to have the first sober home certified by the end of January.