Logic in circuits when using GPIO

Hi
A question from a noob. In Node-Red I have 3 circuits for controlling a pump. Position 1, 2, 3 and stop. I do this via a relay card with 8 relays that are controlled by push buttons in the dashboard and connected via GPIO. That works, but I want to bring some more logic into this.
If the pump is in position 1 it can only be switched off with the stop button. Then you can choose to turn circuit 2 on and this can also be switched off again with the stop button. etc.
You must therefore always press the stop button to select a different position.
Can someone help me?

One way would be to use a state machine, see:

  1. https://github.com/cflurin/node-red-contrib-dsm
  2. https://github.com/cflurin/node-red-contrib-dsm/wiki

Thanks but dsm is not what I looked for.
I did it with triggers