How to add servo control to HA card? esphome

Hi there! My first post jeje

Lets start, first of all i want to configure a “servo motor SG90” to go up and down at certain time. I want to create an automatiation to change the value between -100 and 100, so it moves up/down.

I just configurated the control via esphome web, but i cant control it via Home Assistant, it does not create any sensor or entity that i could modify or automate.

I will like to create a button to turn the value to -100 or 100 or something similar and usefull!

Anyone knows how can i do this?

The config:

# Example configuration entry
  - id: my_servo
    output: pwm_output

# Example output platform
# On ESP32, use ledc output
  - platform: ledc
    id: pwm_output
    pin: GPIO13
    frequency: 50 Hz

  - platform: template
    name: "Servo Control"
    min_value: -100
    initial_value: 0
    max_value: 100
    step: 1
    optimistic: true
        - servo.write:
            id: my_servo
            level: !lambda 'return x / 100.0;'

Thanks for the help!

Did you add the esp on the integration page? You need to do this before the entity will show up.

Yes i finally did it, it was a connection error… I just reboot HA and then disconnect and connect servo and it starts to work…

Btw this code is working, so anyone can use it.