Daylight harvesting

Has anyone ever written coding for daylighting harvesting. I have lux sensors and dimmers in alot of rooms and would like to find the lights based on natural daylight