A schematic diagram of your full setup would help. (Not a 'Fritzing' diagram please.)What code have you written so far, and where is it going wrong?Post your code, (between code tags of course). Code tags can be generated using the </> button in the "Reply" window.
My new truck has "automatic lights" and if we stop under an overpass for a traffic light, it often turns the headlights on (which causes the guy in the car in front of me to think I am flashing at him!)
These automatic headlights - and drivers in general who put headlights on in the daytime - are becoming quite a major menace on the roads.
There are quite a few areas where there are signs up telling you to turn your headlights on for safety (at least here in the US).