Police investigating a house burglary in Gainsborough uncovered a cannabis farm inside the property, Lincoln Crown Court was told.
Officers were sent to the home of James Mulholland after receiving reports of a burglary at the property.
Philip Plant, prosecuting, said: “Police were called to the defendant’s home having received reports of a burglary.
“On arrival officers found two sites where cannabis was growing.
“The first was in the back bedroom. The second was in a walk-in wardrobe in the master bedroom. There was a total of 16 plants.”
Mr Plant said that Mulholland was seen to be injured after being attacked with a machete during the burglary. That matter is still under police investigation.
Mulholland, 45, of Riby Close, Gainsborough, admitted producing cannabis in March this year.
He also admitted breach of a 12 month suspended jail sentence imposed in for possession of a bladed article and breach of a conditional discharge imposed for theft from a shop.
He was given a new five month jail sentence suspended for 12 months.
David Eager, in mitigation, said that Mulholland has changed his life over the last six months and urged that he should not be sent to prison.