ESPHome : stepper with uln2003 goes only clockwise (wemos D1 mini pro)

Hi,

I have a wemos D1 mini pro with an uln2003 to drive a stepper motor (28BYj-48).

It works well but the motor is only spinning clockwise (and doesn’t spin couterclockwise) no matter if I send positive or negative values. The value logged are the one from HA (with correct positive and negative values). I also tried to write directly the target like target: 250 or target: -250 (instead of the lambda) but it doesn’t work either.

My wiring is good because the set up works if I upload code from arduino platform (using accellstepper library).

Here is my code:

api:
services:
- service: control_stepper
variables:
target: int
then:
- stepper.report_position:
id : stepper_vmc
position: 0
- stepper.set_target:
id: stepper_vmc
target: !lambda 'return target;'
- logger.log:
format: "The target value is %d"
args : ['target']

#Etat de la connection
binary_sensor:

    platform: status
    name: "espvmc_Status"

stepper:

    platform: uln2003
    id: stepper_vmc
    pin_a: D0
    pin_b: D1
    pin_c: D2
    pin_d: D3
    max_speed: 50 steps/s
    sleep_when_done: true
    acceleration: inf
    deceleration: inf'

Do yo uhave any ideas of what could go wrong?

ESPHome version : 2021.12.1
HA version : core-2021.12.7