Help with stepper motor code ESPHOME

Hi, im working on a project involving a stepper motor and a relay. when i turn the relay off in home assistant i want it to trigger the stepper to move. can someone explain what im doing wrong here? ive had it move before but now im trying to make it move via the relay turning on or off. or if there a way to make a home assistant controlable switch that does this, i suppsoe that would work too. heres the code: (esphome 8266, D1 mini)

captive_portal:


stepper:
  - platform: uln2003
    id: my_stepper
    pin_a: D0
    pin_b: D1
    pin_c: D2
    pin_d: D3
    max_speed: 250 steps/s
    sleep_when_done: True



script:
  - id: move_tablet
    then:
      - stepper.set_target:
          id: my_stepper
          target: !lambda |-
            if (id(stepper_control).state) {
              return 1000;
            } else {
              return -1000;
            }

switch:
  - platform: gpio
    name: "stepper control"
    id: "stepper_control"
    pin: D5