I like the way bulbs last much longer on a dimmer plus being able to control the amount of light & the ambiance with the dimmer, but would like it to be automatic.

The dimmer is already installed in place of a regular wall switch. Can I wire the photocell at the box where the lights are mounted between the cable powered through the dimmer to the bulb sockets? cable from dimmer---->photocell---->sockets