An electronic hygrostat measures relative humidity inside enclosures containing electrical and electronic components. When the set relative humidity threshold is exceeded, a heating system is activated to prevent condensation from forming inside the enclosure.