Stepmotor with 3 saved targets

Hi,

I’m trying to control switch (pic below) with ESP8266 and 28byj-48 ULN2003. That switch is for my ventilation system.
Sieppaa1

I’ve been testing different codes for 2 weeks without success. I’m struggling with the code. The purpose is to control the ventilation according to the humidity and when I am at home/away. Does anyone have a code for this purpose? Below is the latest I’ve tried.

esphome:
  name: ilmanvaihtokone

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "xxxxxx"
  services:
    - service: set_stepper_level
      variables:
        level: string
        steps: int
      then:
        - stepper.named_target:
            id: stepper_motor
            target: !lambda "return id(stepper_level)[level];"
            wait: true

stepper:
    - platform: uln2003
      id: stepper_motor
      sleep_when_done: true
      pin_a: GPIO5
      pin_b: GPIO4
      pin_c: GPIO0
      pin_d: GPIO2
      max_speed: 500 steps/s
      # Optional:
      acceleration: inf
      deceleration: inf

stepper.named_target:
  '1':
    steps: 512
    direction: clockwise
  '2':
    steps: 1024
    direction: counter_clockwise
  '3':
    steps: 512
    direction: clockwise