I have 2 optical sensors on my system.
1) First sensor is use for top off my water. Its always wet. If the sensor doesn't see the water, it will open a solenoid and flow water to my tank, but on a timer. If it takes to long to get back to see the sensor, it will sound the alarm off and stop the water flow.
2) Second sensor is use for only 2 alarms. Its always dry.
a) It will alarm if my main pump stop working.
b) It will alarm, if my top off completely fails.
Been using these for a awhile, i have yet to clean them and never had them failed.