RV Tank automatic flushing with back flushing

I have a thought that I have bouncing around in my head in regards to my RV automation scheme. The next step I have is to automate (in some regards) the dumping of the holding tanks. For side note, I have installed the automated gate valves for the waste holding tanks, I have SeeLevel sensors which feed into Home Assistant telling HA exactly what % the tank is full, I also am utilizing LinkTap valves that can turn on/off flow of water to specific areas of the rig, they can also register the amount of water flowing through in gal/min and total volume for current fill.

Status Number chart for helper that tracks current status of tank:
0 - Not active
1 - Open Tank, auto drain tank ready
2 - Close Tank, activate flush
3 - Flush reached 20 gallon mark (remain on)
4 - Open Tank, wait 90 seconds (flush still active)
5 - Open Tank, Flush not active
6 - Close Tank, Flush complete

Here is a step by step rough idea that I have going for me.

  1. Alexa command or button trigger to dump Black tank
    2a) If status is NOT 0, stop execution. Announce “XXX Tank is already being flushed, please stand-by.”
    2b) If status is 0, change to status 1. Announce “Now draining XXXX tank, please stand-by.”
  2. Open tank
  3. When Tank reads 0% and status is 1, start 1 minute timer
  4. Timer stops, change to status 2
  5. Close Tank, activate back flush. (SHOULD I INCLUDE Announce “Now back flushing tank”.??)
  6. When volume registers at least 20 gallons and status is 2, change status to 3
  7. Status is at 3, open tank
  8. Wait 90 seconds, change status to 4
  9. Status is 4 and tank is open, shut off flush, change status to 5
  10. When tank reads 0% and status is 5, start 1 minute timer
  11. Timer stops status is 5, close tank, change status to 6. Announce “XXX Tank has been drained and flushed.”
  12. Change status to 0 for reset.