Optical sensor for the determination of moisture