Ai-thinker esp32-cam with servo control

Hello all!
I have gotten the camera working with HA but as soon as I try to configure servo I get only “[esp32_camera:162]: Got invalid frame from camera!”
I am following https://siytek.com/esphome-servo-example/ with changes to esp32 from ESP32 LEDC Output — ESPHome .
I have tried other pins other than GPIO2 and it is all the same. As far as I can tell there is no mention of these tf card pins being used for anything in esp32_camera.cpp so they should be free to use. Someone with better understanding on how this works got any ideas?

default_yaml:

esphome:
  name: default

esp32:
  board: esp32cam
  framework:
    type: arduino

# Enable logging
logger:

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

ota:
  password: "***"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Default Fallback Hotspot"
    password: "**"

captive_portal:
    
    
# ESP32-CAM
esp32_camera:
  external_clock:
    pin: GPIO0
    frequency: 20MHz
  i2c_pins:
    sda: GPIO26
    scl: GPIO27
  data_pins: [GPIO5, GPIO18, GPIO19, GPIO21, GPIO36, GPIO39, GPIO34, GPIO35]
  vsync_pin: GPIO25
  href_pin: GPIO23
  pixel_clock_pin: GPIO22
  power_down_pin: GPIO32
  resolution: 1280x1024
  jpeg_quality: 10

  name: bedroom
  # ... Frame Settings

# Flashlight
output:
  - platform: gpio
    pin: GPIO4
    id: gpio_4
  - platform: ledc
    id: pwm_output
    pin: GPIO2
    frequency: 50 Hz

light:
  - platform: binary
    output: gpio_4
    name: $hostname light

servo:
  - id: my_servo
    output: pwm_output
    

log output:

INFO Reading configuration /config/esphome/default.yaml...
WARNING GPIO0 is a Strapping PIN and should be avoided.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
WARNING GPIO4 is a Strapping PIN and should be avoided.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
WARNING GPIO2 is a Strapping PIN and should be avoided.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
INFO Starting log output from default.local using esphome API
WARNING Can't connect to ESPHome API for default.local: Error resolving IP address: [Errno -5] No address associated with hostname
INFO Trying to reconnect to default.local in the background
INFO Successfully connected to default.local
[12:13:40][I][app:102]: ESPHome version 2022.8.3 compiled on Sep 28 2022, 09:50:05
[12:13:40][C][wifi:491]: WiFi:
[12:13:40][C][wifi:353]:   Local MAC: 0C:DC:7E:61:55:98
[12:13:40][C][wifi:354]:   SSID: [redacted]
[12:13:40][C][wifi:355]:   IP Address: 192.168.1.156
[12:13:40][C][wifi:357]:   BSSID: [redacted]
[12:13:40][C][wifi:358]:   Hostname: 'default'
[12:13:40][C][wifi:360]:   Signal strength: -38 dB ▂▄▆█
[12:13:40][C][wifi:364]:   Channel: 1
[12:13:40][C][wifi:365]:   Subnet: 255.255.255.0
[12:13:40][C][wifi:366]:   Gateway: 192.168.1.1
[12:13:40][C][wifi:367]:   DNS1: 192.168.1.168
[12:13:40][C][wifi:368]:   DNS2: 0.0.0.0
[12:13:40][C][logger:275]: Logger:
[12:13:40][C][logger:276]:   Level: DEBUG
[12:13:40][C][logger:277]:   Log Baud Rate: 115200
[12:13:40][C][logger:278]:   Hardware UART: UART0
[12:13:40][C][gpio.output:010]: GPIO Binary Output:
[12:13:40][C][gpio.output:011]:   Pin: GPIO4
[12:13:40][C][ledc.output:118]: LEDC Output:
[12:13:40][C][ledc.output:119]:   Pin GPIO12
[12:13:40][C][ledc.output:120]:   LEDC Channel: 0
[12:13:40][C][ledc.output:121]:   Frequency: 50.0 Hz
[12:13:40][C][light:104]: Light '$hostname light'
[12:13:40][C][esp32_camera:048]: ESP32 Camera:
[12:13:40][C][esp32_camera:049]:   Name: bedroom
[12:13:40][C][esp32_camera:050]:   Internal: NO
[12:13:40][C][esp32_camera:052]:   Data Pins: D0:5 D1:18 D2:19 D3:21 D4:36 D5:39 D6:34 D7:35
[12:13:40][C][esp32_camera:053]:   VSYNC Pin: 25
[12:13:40][C][esp32_camera:054]:   HREF Pin: 23
[12:13:40][C][esp32_camera:055]:   Pixel Clock Pin: 22
[12:13:40][C][esp32_camera:056]:   External Clock: Pin:0 Frequency:20000000
[12:13:40][C][esp32_camera:057]:   I2C Pins: SDA:26 SCL:27
[12:13:40][C][esp32_camera:058]:   Reset Pin: -1
[12:13:40][C][esp32_camera:085]:   Resolution: 1280x1024 (SXGA)
[12:13:40][C][esp32_camera:101]:   JPEG Quality: 10
[12:13:40][C][esp32_camera:103]:   Contrast: 0
[12:13:40][C][esp32_camera:104]:   Brightness: 0
[12:13:40][C][esp32_camera:105]:   Saturation: 0
[12:13:40][C][esp32_camera:106]:   Vertical Flip: ON
[12:13:40][C][esp32_camera:107]:   Horizontal Mirror: ON
[12:13:41][C][esp32_camera:108]:   Special Effect: 0
[12:13:41][C][esp32_camera:109]:   White Balance Mode: 0
[12:13:41][C][esp32_camera:112]:   Auto Exposure Control: 1
[12:13:41][C][esp32_camera:113]:   Auto Exposure Control 2: 0
[12:13:41][C][esp32_camera:114]:   Auto Exposure Level: 0
[12:13:41][C][esp32_camera:115]:   Auto Exposure Value: 300
[12:13:41][C][esp32_camera:116]:   AGC: 1
[12:13:41][C][esp32_camera:117]:   AGC Gain: 0
[12:13:41][C][esp32_camera:118]:   Gain Ceiling: 0
[12:13:41][C][esp32_camera:124]:   Test Pattern: NO
[12:13:41][C][servo:013]: Servo:
[12:13:41][C][servo:014]:   Idle Level: 7.5%
[12:13:41][C][servo:015]:   Min Level: 3.0%
[12:13:41][C][servo:016]:   Max Level: 12.0%
[12:13:41][C][servo:017]:   auto detach time: 0 ms
[12:13:41][C][servo:018]:   run duration: 0 ms
[12:13:41][C][psram:020]: PSRAM:
[12:13:41][C][psram:021]:   Available: YES
[12:13:41][C][captive_portal:088]: Captive Portal:
[12:13:41][C][mdns:094]: mDNS:
[12:13:41][C][mdns:095]:   Hostname: default
[12:13:41][C][ota:085]: Over-The-Air Updates:
[12:13:41][C][ota:086]:   Address: default.local:3232
[12:13:41][C][ota:089]:   Using Password.
[12:13:41][C][api:138]: API Server:
[12:13:41][C][api:139]:   Address: default.local:6053
[12:13:41][C][api:141]:   Using noise encryption: YES
[12:13:41][W][esp32_camera:162]: Got invalid frame from camera!

Same with:

# Flashlight
output:
  - platform: ledc
    pin: GPIO4
    id: gpio_4

fan:
  - platform: speed
    output: gpio_4
    name: $hostname light

I think ledc is out of business.
Found it in esp32_camera.cpp:

this->config_.ledc_timer = LEDC_TIMER_0;
this->config_.ledc_channel = LEDC_CHANNEL_0;

I think this could be changed to last timer and channel.

Adding “channel: 1” solved this issue. esphome:name need to be given without quotes otherwise it will not work right so that’s second bug. No errors, it just wont output anything on the pin - checked with a logic analyzer and I do get random movement if using TX pin so the servo is ok.
Servo Component — ESPHome suggests using number as I am HA newbie I do not know how to control this. So close yet so far…