Hello,
I have a Wemos D1 Mini + a servomotor and it’s working fine from a number input to move the servo.
I want to turn on my espresso machine and for that I need to pus a button and come back to position 0.
How can I achieve that: push a button in HA and then the servo to move forward and to come back after pressing a button?
esphome:
name: espresso-machine
esp8266:
board: d1_mini
# Enable logging
logger:
# Enable Home Assistant API
ota:
password: "x"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
fast_connect: on
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Espresso-Machine"
password: "x"
captive_portal:
output:
- platform: esp8266_pwm
id: pwm_output
pin: D4
frequency: 50 Hz
servo:
- id: my_servo
output: pwm_output
api:
# services:
# - service: control_servo
# variables:
# level: float
# then:
# - servo.write:
# id: my_servo
# level: !lambda 'return level / 100.0;'
number:
- platform: template
name: Servo Control
min_value: -200
max_value: 200
step: 1
set_action:
then:
- servo.write:
id: my_servo
level: !lambda 'return x / 100.0;'
Thanks.