Dwelling units shall be equipped with smoke detecting devices receiving their primary power from the building wiring and there shall be no switches in the circuit other than the over-current device protecting the branch circuit; provided, however, that dwelling units in existing buildings may, in the alternative, be equipped with battery-operated smoke detecting devices except where such buildings are substantially improved or altered on or after January first, nineteen hundred eighty-two.