Whenever any counterclaim or claim of defense under this section is based on any allegation concerning the condition of the premises or the services or equipment provided therein, the tenant or occupant shall not be entitled to relief under this section unless: (1) the owner or his agents, servants, or employees, or the person to whom the tenant or occupant customarily paid his rent knew of such conditions before the tenant or occupant was in arrears in his rent; (2) the plaintiff does not show that such conditions were caused by the tenant or occupant or any other person acting under his control; except that the defendant shall have the burden of proving that any violation appearing solely within that portion of the premises under his control and not by its nature reasonably attributable to any action or failure to act of the plaintiff was not so caused; (3) the premises are not situated in a hotel or motel, nor in a lodging house or rooming house wherein the occupant has maintained such occupancy for less than three consecutive months; and (4) the plaintiff does not show that the conditions complained of cannot be remedied without the premises being vacated; provided, however, that nothing in this clause shall be construed to deprive the tenant or occupant of relief under this section when the premises are temporarily vacated for purposes of removal or covering of paint, plaster, soil or other accessible materials containing dangerous levels of lead pursuant to section one hundred and ninety-seven of chapter one hundred and eleven.