Wallbox Pulsar Plus load balancing

Our car is able to charge at maximum 3600W / 16A
we are in possesion of a Wallbox Pulsar +
the connection with the wallbox app on the homey works excelent.
Also a P1 meter is available in the wallbox.

I am looking for someone who can help me define a (advanced) flow to do the following:

When the wallbox starts loading it needs to start at 1 Amp.
If the P1 power is negative (supply to the net) increase charging speed untill the power is around 0
If the P1 power is positive pause charging and continue if the power is negative again.
I think there should be a delay in switching to prevent fast changes. please advise if you have experience on this.

Problem I am facing is that I can not figure out how to put the calculation in the (advanced) flow. If the charging amps are to be changed it should also include the actual amps, otherwise it will create an oscilation effect.

Hope someone can help me in the right direction.