I've had this in my vimrc for a little while:

  let hr = (strftime('%H'))
  if hr >= 17
      set background=dark
  elseif hr >= 7
      set background=light
  elseif hr >= 0
      set background=dark
  endif
Using a light sensor would be cool, but I actually work from a desktop PC most of the time, so no sensor. I guess the next best thing would be something like f.lux does: query some web service for the sunset time at your current location.

It is possible to purchase a small USB lux meter:

http://www.yoctopuce.com/EN/products/usb-environmental-senso...

I use one to automatically adjust the brightness of my Dell display.

what display and how do you control your display from your PC?

I have a Dell P4317Q, a great 43 inch display, and control it from my Mac with ddcctl: https://github.com/kfix/ddcctl