I'm automating my dogs' water bowl and for that I'm using two hacked contact sensor together with two water level sensors (closed = with water, opened = no water) , a two channel relay to control a water pump and a solenoid valve, according to the following drawing:
The idea is that every three hours, during the day, the system executes the following cycle:
If the low sensor is open (no water) activate the solenoid valve until the high sensor changes to closed (bowl full of water).
If the low sensor is closed (bowl with some water) activate the pump (to pump water out) until the low sensor changes to open (bowl empty) and then activate the solenoid valve until the high water sensor changes to closed (bowl full of water).
I also want to have a button that whenever pressed runs the entire cycle.
I've done all the hardware work, wired everything, but cannot make this rule as I have no programming knowledge.
Triggers (any one of these events will trigger the flow):
Certain Time (set multiple of these per your desired schedule)
Button pushed
Actions:
Conditional Action -> IF...THEN
** IF low sensor is closed (some water) THEN
** Activate pump
** Wait for event: low sensor open (empty)
** Turn off pump
** ENDIF
Activate Solenoid Valve
Wait for event: high sensor closed (full)
Turn off solenoid valve
That's my off-the-cuff flow based on what you described. You only need to run the pump if there is still water in the bowl, but every time you want to fill it back up (regardless of initial state).
As an overflow protection I would add a float switch in series with pump.
Otherwise you may create a flood if high level sensor, pump relay and/or hub will fail.
Probably for something will go wrong is not 0. Murphy Law never fails.