This invention is directed to a self-commissioning photosensor and controller device that turns electric lights on and off using a microprocessor connected to a luminaire. The processor receives signals from a self-commissioned mountable photosensor. The photosensor uses a unique algorithm to control illumination at the task pane making the photosensor more accurate than current market technologies. Light energy consumption can be reduced by up to 30% and commercial customers can be recompensed in as soon as one year after installation. The device can be used in existing or new light fixtures. The device also installs without additional wire runs or ballast replacement rendering it easy to install, low-cost and effective.