@ato_arduino I too am confused.
What is the connection or logic or constraint between the two solenoids and whatever they do?
@gcjr's code runs two completely unrelated solenoid logic/timing sections.
@noiasca's state diagram doesn't make the connection obvious, at least m[not yet to me.
And your words
are ambiguous.
Try plain words again. Name the solenoid(s) when you mention them.
The flush solenoid should turn on for 20 seconds every time the fill solenoid finishes, the fill solenoid is turned off by the high eye and then then flush solenoid should run.
It see? The flush solenoid should run 20 seconds once an hour if the high eye says the tank is full.
Say what you want like that. Plain thorough and unambiguous. The code is no problem, understandable what you want is clear yet not.
a7