Or what I have done (being a cheap ***) is take an inductive prox and depending on application use orange safety pull cord that pulls a metal target away from sensor. (no matter what you need a SIL II or SIL III safety relay (like allen bradley AB guardmaster, or phoenix contact etc.)