Protecting devices located at the ends of barriers