The humidity sensor as found by Steve seems the way to go but if you wish to make your own, then a flag in a slotted optical coupler would be the easiest.
You will need to realise that the sensor, whatever it is will not respond instantly since time will be required for the moisture to...