It is recommended to increase the "number of times" item in the trigger options for automation

This is just a test, and it will be deployed to an existing device.
And I have now modified the scheme, there is no need to set the counter to zero. it will run in the following way, the motor forward rotation, counter increase, motor reverse rotation, counter reduction.