Toggle INTERNAL_LED with Home Assistant

Is it possible to toggle the Onboard Red LED with HASS?
I have tried to upload a few ideas with the yaml:
But nothing worked:

switch:
  - platform: gpio
    pin: GPIO2
    name: "Onboard LED"
    id: onboard_led_switch
  - platform: gpio
    pin: GPIO022
    name: "Onboard LED22"
    id: onboard_led_switch22
  - platform: gpio
    pin: GPIO01
    name: "Onboard LED1"
    id: onboard_led_switch1
  - platform: gpio
    pin: GPIO021
    name: "Onboard LED21"
    id: onboard_led_switch21

EDIT:

esp32:
  board: esp32dev
  framework:
    type: esp-idf
ota:
  - platform: esphome
    id: ota_esphome

what board?

Sorry forgotten the board: esp32dev i Have added it above

Then it should work on gpio2
try this to see if the LED is working

interval:
  - interval: 1s
    then:
      - switch.toggle: onboard_led_switch
1 Like

I have added this code:

switch:
  - platform: gpio
    pin: GPIO2
    name: "Onboard LED"
    id: onboard_led_switch
 
interval:
  - interval: 1s
    then:
      - switch.toggle: onboard_led_switch

And got this outpput:

[12:22:25][D][switch:055]: 'Onboard LED': Sending state ON
[12:22:26][D][switch:020]: 'Onboard LED' Toggling OFF.
[12:22:26][D][switch:055]: 'Onboard LED': Sending state OFF
[12:22:27][D][switch:020]: 'Onboard LED' Toggling ON.
[12:22:27][D][switch:055]: 'Onboard LED': Sending state ON
[12:22:29][D][switch:020]: 'Onboard LED' Toggling OFF.
[12:22:29][D][switch:055]: 'Onboard LED': Sending state OFF
[12:22:29][D][switch:020]: 'Onboard LED' Toggling ON.
[12:22:29][D][switch:055]: 'Onboard LED': Sending state ON

But the physical red light stays on, on the ESP32-WROOM-32D

Then it’s the power LED.

okay thanks, and I think this one can’t be switched?

If it’s immediately on when you power your board, it’s not controllable.
There’s no rule for LEDs, some boards have two, others just power and some have connected to gpio.

HERE they say that blue led is connected to GPIO2. But if it doesn’t work for you, then it’s a different type of esp32dev board… (a clone…?)