esphome:
  name: bedroomblinds
  platform: ESP8266
  board: huzzah

wifi:
  ssid: "WIFI_SSID"
  password: "WIFI_PSK"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Blinds Fallback Hotspot"
    password: "**********"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:
  services:
    - service: control_left_stepper
      variables:
        target: int
      then:
        - stepper.set_target:
            id: leftwindow
            target: !lambda 'return target;'
    - service: control_right_stepper
      variables:
        target: int
      then:
        - stepper.set_target:
            id: rightwindow
            target: !lambda 'return target;'
    - service: open_blinds
      then:
        - stepper.set_target:
            id: rightwindow
            target: 0
        - stepper.set_target:
            id: leftwindow
            target: 0
    - service: close_blinds
      then:
        - stepper.set_target:
            id: rightwindow
            target: 15500
        - stepper.set_target:
            id: leftwindow
            target: 16500
ota:


# Set up the stepper
stepper:
  - platform: uln2003
    id: leftwindow
    pin_a: D16
    pin_b: D12
    pin_c: D14
    pin_d: D13
    max_speed: 250 steps/s
    acceleration: 45
    deceleration: 22
    sleep_when_done: true

  - platform: uln2003
    id: rightwindow
    pin_a: D5
    pin_b: GPIO4
    pin_c: GPIO0
    pin_d: GPIO2
    max_speed: 250 steps/s
    acceleration: 45
    deceleration: 22
    sleep_when_done: true