Controlling servos

Hey all ESP homies (get it? :slight_smile: )

I’m working on a robot garage for my vacuum. It’s based on this design but I’m having some major issues.

So I reverted just to create Proof-of-concept first, so I followed this guide. However, when I call the service through the developer tools I get this error:

Failed to call service esphome.livingroomgarage_control_servo. Unknown error

It seems to be the same whether or not the controller is on or off. What am I missing here?

Hardware:
JCPower 5v 10A power supply
MG996R servos
NodeMCU

I use this wiring;

YAML:

esphome:
  name: livingroomgarage
  platform: ESP8266
  board: nodemcuv2

# Enable logging
logger:

# Enable Home Assistant API
api:
  services:
    - service: control_servo
      variables:
        level: float
      then:
        - servo.write:
            id: my_servo
            level: !lambda 'return level / 100.0;'

ota:

wifi:
  ssid: xxx
  password: xxx
  manual_ip:
    static_ip: 192.168.1.102
    gateway: 192.168.1.1
    subnet: 255.255.255.0

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Livingroomgarage"
    password: xxx

captive_portal:

output:
  - platform: esp8266_pwm
    id: pwm_output
    pin: D3
    frequency: 50 Hz
 
servo:
  - id: my_servo
    output: pwm_output