A diarylethene ligand-anchored two-dimensional Hofmann-type compound [FeII(BTEPy){Pt(CN)4}](CH3OH) (BTEPy = 1,2-bis[2-methyl-5-(4-pyridyl)-3-thienyl]cyclopentene) is synthesized, which undergoes a two-step spin-state transition and dual photoinduced magnetic switching.