This automation is intended to create an ATO (Automated-Top-Off) automation for your aquarium, or anything else that needs to be refilled. You would use a binary sensor to determine the presence of water, typically an Optical Water Sensor, and control a water pump via switch when necessary. The automation will turn the selected switch on when the sensor turns off, and off then when the sensor turns back on. By default, the switch will automatically turn off after 5 mins of being on to prevent overfill.
Binary Sensor:
AquaPi Version (Uses text sensor with states: Low | Normal | High):
You may want to include a routine to turn off the ato sensor sequence when the return pump is turned off and restart it 15 minutes after the return is turned on and the levels stabilize. This will prevent overflows for people who have smaller aquariums.
I believe you can achieve that by using the condition to only run the automation when the return pump is on. Also, I could use additional actions IF they were at the end of the automation. To achieve that, I added another additional actions option, but at the end. Use a delay then turn on the pump.