ESPHome - control servo using REST-ful API

Hey,
I’ve followed the servo component tutorial for esphome (https://esphome.io/components/servo.html?highlight=servo).

My servo.yaml configuration for ESPHome is:

output:
  - platform: esp8266_pwm
    id: pwm_output
    pin: GPIO2
    frequency: 50 Hz

servo:
  - id: my_servo
    output: pwm_output

web_server:
  port: 80
  auth:
    username: <secret>
    password: <secret>

I can access the web server through my browser (http://<ip_of_esp>), but there doesn’t seem to be any option to control the servo from it.

Is there a way to control the servo using REST-ful API? What command would I need to type in CURL?

I still haven’t found any solutions to my problem. Any help with how to solve it would be greatly appreciated.

Hola mira te comento hasta donde yo puede llegar. Seguramente te sale un error 401 cuando intentas hacer alguna petición, esto se trata por que los esphome se autentifican con un protocolo llamado digest.
Estoy tratando de resolver el algoritmo que te pide para autentificar (md5), pero no estoy teniendo éxito. No tengo más información. Espero que te halla servido de ayuda.

The easiest way to control the servo from the ESPHome web interface is to define a switch in your esp .yaml file:

#  define a switch to control the servo
  - platform: template
    name: "Servo Control"
    id: servo_control
    optimistic: true
    # internal: true
    
    turn_on_action:
      - servo.write:
          id: my_servo
          level: -.6

    turn_off_action:
      - servo.write:
          id: my_servo
          level: .8

At the same time, make sure the web server displays internal variables:

# enable (local) web server
web_server:
  port: 80
  include_internal: true
  local: true

Now, you can navigate to the esp node website myespnodename.local:80 and the servo control switch will be displayed. Adjust the servo levels as desired for your application.

The Docs arent a “tutorial” they’re more of a bare minimum configuration examples. All your code does is define a servo attatched to a certain gpio. You still need to create buttons, switches, slider, a number box or some other way of “telling” the servos what to do and which direction.