Complex sentence: The lighting was switched on and off by a device linked to a chicken perch-as the chickens went to roost in the evenings the lights were turned on, and when the chickens left their roost in the mornings the lights were switched off again.
Split into simpler sentences: The lighting was switched on and off by a device linked to a chicken perch-as the chickens went to roost in the evenings the lights were turned on. When the chickens left their roost in the mornings the light were switched off again.