That's a very interesting idea. Thanks for the suggestion. It is still invasive since I have to cut the intake pipe and insert a section with the sensor installed in it. But it is more flexible since I can install it in any size pipe. And for my use case of a 1 inch input pipe it can be cheaper than my current solution. For example
https://www.aliexpress.com/item/15mA-5V-Optical-Infrared-Wat...Although, I wonder if scaling (as in hard water scale) is still going to be an issue.