I have a rather unique process for water changes and ATO. But in essence I have a 2 sensor ATO that is enabled only at a certain time in the day, when the main pump (sump to tank) is off.

The optical level sensors get dirty easily because they are getting covered by water and then dry several times per day, when automated water change happens.

Because of that, they tend to provide false positive results (detect water when they are dry), preventing ATO from working.

Most of the time in the day, the level sensors are expected to be completely dry when the main pump is working, so if at this point they read positive, I know they need a cleaning.

How can I trigger an alert (e.g. email) if the main pump is on and the level sensors sense water?

I have created programmable logic for pump being on for more than 5 mins, and I think I also have programmable logic for sensors detecting water based on ATO state, but how can I trigger an alert with this?