Use Brightness sensor to automatically start sleep tracking

It would be great to track the light during the night using the phones Brightness sensor. Combined with the motion sensors and sleep habits the app could detect the beginning of the sleep automatically. Additionally it could monitor the lighting through the night and record it like the noise in a chart.