Photo-control of the magnetic properties of Dy(III) and Ho(III) homometal coordination polymers bridged by a diarylethene ligand.