Assuming you use a class 2 power supply this could be done.

I would look into using non-contact proximity sensors.


Bob Badger
Construction & Maintenance Electrician
Massachusetts