Check engine light?

I own a 2006 Nissan Sentra and 2 days ago it rained then the next day as I was driving to work the check engine light came on so I took it to O Reilly and they said it was my thermostat. I told him a year from now the light came on and it was the same problem and when that happened the day before the light came on

I own a 2006 Nissan Sentra and 2 days ago it rained then the next day as I was driving to work the check engine light came on so I took it to O Reilly and they said it was my thermostat. I told him a year from now the light came on and it was the same problem and when that happened the day before the light came on it was rainning and really cold out but when I changed my battery in May the light came off. When I got the car last year in march the light came on too so I reset the battery and boom it came off. So the guy and O Reilly said to do it again and if the light stays on then I have a problem but if not I m good, so I did it and again it turned off and hasn t came on again. My question is why does it do that, is it going out slowly or just a affect from the rain this is the 3rd it happened to me in 2 years of owning it? (Car doesn t get drove in rain that much, due to now getting much rain here in vegas)

Other answer:

Julian:
Every time you pull the battery the computer resets and the rain has nothing to do with your problem but the cold weather does.
The computer looks to make sure the engine gets up to operating temperature and if it doesn't do that quickly enough, enough times, it will trigger the engine light. You don't have the problem during warmer weather because the thermostat that's stuck open a little bit only presents a problem in cold weather.
Get it replaced, it's causing bad gas mileage and engine wear, also a potential for getting stuck closed which will cause very expensive engine damage.
Mah Jen Boo:
well, it's pretty obvious that something is wrong with it. and the problem doesn't get bad enough until it rains, to cause the sensor to cause a signal. next time it happens take it to a real mechanic. them people at O Reilly is a freaking joke. they never noe what the hell they talking about half the time. a bad thermostat will not cause the check engine light to come on. it will cause the car to either be under heated or over heated. so if the temp of the car stays steady then, there is nothing wrong with it.
ponderer:
There is no code that says,"Its your thermostat". You have to understand the codes and what they are saying. Not to mention engine mechanics. On some models the code of not reaching operating temperature soon enough actually means it needs an o2 sensor. As long as your temp gauge is acting normal you should be ok with this kind of problem.
don r:
The light isn't the problem any more than duct taping a baby's wailing mouth changes his wet diaper. Pull the code, look up it's definition, then see how to repair the problem.Fix what's messed up.
Nomadd:
Stop resetting the computer without knowing what the code is. Now you'll never know what made the light come on. You can buy a code reader for $20.
thebax2006:
Sure would help if you listed the actual code instead of what a sales person thinks the problem is! I wouldn't trust a parts counter person to diagnose anything!
Ron:
Sounds like a bit of a short in the sensor or wiring when it gets wet.
?:
Only comes on if a fat lard who's retarded sits in the driver seat. Sounds like a you problem
Timbo is here:
You have a fault. DISCONNECTING THE BATTERY RESETS THE ECU BUT AS SOON AS THE FAULT IS DETECTED AGAIN THEN THE LIGHT COMES ON