Farley Small was arrested when police searched his house in Leeds and seized dried cannabis leaves with a street value of between £6,000 and £7,000.
Leeds Crown Court heard the property was equipped with extractor fans and heat lamps.
Alex Menary, prosecuting, said officers recovered 27 potted plants from the house.
Small's mother and his two siblings were at the house at the time, on December 10 last year.
The defendant was arrested when he returned home while the police were still there.
Small, 25, of Wykebeck Valley Road, pleaded guilty to producing cannabis.
Probation officer Gary Kilbride told the court: "The defendant admitted that he intended to make a financial gain from cannabis.
"He was motivated to provide for his family at Christmas."
Mr Kilbride said Small's family were struggling financially after his mother lost her job through illness.
Nicholas Hammond, mitigating, said the father-of-two work as a roofer and is in a relationship.
Small was given an eight-month prison sentence, suspended for 18 months.
He was also ordered to do 100 hours of unpaid work and complete 20 rehabilitation activity requirement days.
Sentencing, Judge Simon Batiste said: "You could have absolutely no complaints if I locked you up today.
"You were growing cannabis for profit at your home.
"You were indicating that you were trying to provide for Christmas for your family given the difficulties some members of your family have had."
Judge Batiste said he was able to suspended the sentence because of Small's previous good character.