I am trying to get my stepper motor (with ULN2003 control board) working with HA.
I want a slider to adjust the rotation of my stepper motor.
However, I cannot get it working in HA. (My setup works in Arduino, so I think my wiring is correct.)
My automations.yaml code:
- id: zonnelogger
alias: Write stepper Value to ESP
trigger:
- platform: state
entity_id: input_number.stepper_control
action:
- service: esphome.zonnelogger_control_stepper
data_template:
target: '{{ trigger.to_state.state | int }}'
my configuration.yaml code:
input_number:
stepper_control:
name: Stepper Control
initial: 0
min: -1000
max: 1000
step: 1
mode: slider
My ESPHome code (zonnelogger.yaml)
esphome:
name: zonnelogger
esp8266:
board: d1_mini
# Enable logging
logger:
# Enable Home Assistant API
api:
services:
- service: control_stepper
variables:
target: int
then:
- stepper.set_target:
id: my_stepper
target: !lambda 'return target;'
ota:
password: "***"
wifi:
ssid: ***
password: ***
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Zonnelogger Fallback Hotspot"
password: "***"
captive_portal:
stepper:
- platform: uln2003
id: my_stepper
pin_a: GPIO5
pin_b: GPIO4
pin_c: GPIO0
pin_d: GPIO2
max_speed: 250 steps/s
sleep_when_done: true
step_mode: FULL_STEP
# Optional:
acceleration: inf
deceleration: inf
I am completely clueless! Any advice is greatly appreciated!