West Yorkshire Police officers went to the property and found cocaine and cash in Ben Wilkinson's home in Pudsey along with cannabis plants.
Leeds Crown Court heard British Gas contacted the police in 2019 to inform them that the electricity meter at Wilkinson's home on Springbank Close had been bypassed.
The police were told that the meter was seriously unsafe and could cause harm to members of the public.
Leeds Festival road closures: Aberford village will be closed to festival traffic after being used as a 'rat run'
Man dead after a paragliding accident near to Leeds
Leeds drug farmer locked up after being handed 'lenient' sentence
Murderer David Hill who bludgeoned his millionaire mother-in-law to death is released from prison on licence
Wakefield rugby club incident: Man arrested on suspicion of murder after victim dies following attack
Officers went to the house, where Wilkinson lived with his girlfriend and another man, on February 1, 2019.
His girlfriend was the only one at home at the time.
Officers searched the property and found cannabis growing in one of the bedrooms.
Fatima Zafar, prosecuting, said the cannabis plants belonged to the other man living at the house.
Wilkinson's bedroom was searched and 24g of cocaine was found along with mixing agents including benzocaine.
Digital scales, dealer bags, ladles, sieves and mixing bowls were also found in the room.
The officers also found £2,950 in cash in a sock.
Wilkinson returned home while the police were still at the house and he was arrested.
During an interview he accepted responsibility for bypassing the electricity supply.
He also accepted owning the cocaine but claimed he had the class A drug for personal use.
Wilkinson pleaded guilty to possessing a class A drug with intent to supply and abstracting electricity.
The defendant pleaded guilty to the drug offence on the basis that the cocaine was mainly for his own use but that he occasionally supplied it to others.
He has nine previous convictions, including six offences of violence.
Glenn Parsons, mitigating, said Wilkinson was a hard worker and had not been in trouble in almost three years since the incident.
Wilkinson, now of Beecroft Gardens, Bramley, was given a 16-month prison sentence, suspended for 12 months.
He was also ordered to do 100 hours of unpaid work.
Sentencing, Judge Geoffrey Marson QC said: "Dealing in class A drugs at whatever level is a serious offence indeed.
"If I thought that you were supplying for a significant financial reward then you would have been going to custody for several years.
"In your favour you are a hard worker and have not offended since.
"You have tried to put your life in order and in all the circumstances I am prepared to suspend the inevitable prison sentence."
The other man living at the house pleaded guilty to producing cannabis and was made the subject of a community order when he appeared in court last September.