Smart polymer coatings for protection from corrosion