Comitronic safety switch position control for doors or casings on dangerous machinery with magnetic holding devices