How would you trigger an alert for a boolean status over a period of time

How would you trigger an alert for a boolean status over a period of time

for example:
if water is flowing: flowrate = 1 
if water is not flowing : flowrate = 0

how would i use this to trigger an alert if flowrate = 1 for (x) amount of time then send email etc...