HTML5 now gives you access to the ambient light sensors on smartphones & notebooks. It is currently supported in Firefox.

window.addEventListener('devicelight', function(event)
{
    if (event.value < 50)
    {
        console.log('Hey! It\'s dark in here!');
    }
});

Demo: http://aurelio.audero.it/demo/ambient-light-api-demo.html

How would you incorporate this feature into your web apps?