if sitting in the sun on a hot day, my family's 1995 Mazda protege 323's headlights will come on, even though they are not switched on. This occurs with the car off, and the keys out. The simple way to turn them off is to disconnect the battery, as repeated use of the light switch has no effect. Once the car interior cools down, the battery can be reconnected and the problem is resolved until next time it is sitting in the sun (with windows up). I called a local auto electrics shop who claimed to have never heard of this problem before. Any ideas?
A bad headlight relay
Have the relay tested or replaced. It could be that the switch for the main circuit is intermittently stuck-closed.
A closed-circuit in the light switch or relay getting grounded
Eliminating a bad relay would leave you the possibility that the relay is being activated when it shouldn't through an intermittent closed-circuit.
Could sunlight cause an intermittent closed-circuit?
Perhaps heat is a more relevant player here. The thermal expansion of wires could be responsible for the intermittent behavior that is observed here.
If your alarm flashes the headlights, then the electronics in the alarm could also be at fault.