Help with ESP32-CAM and a light ring

Hi,

I have problems with an ESP32 CAM and a light ring. I want the light ring to only light up LED 1 to 6 for 11s and then go black.

With the code down under the right LEDs light up but after 1s all LED turns on. And after 11s all LEDs go black as it should do.

Im new to this so I guess its just something wrong in the code.

esphome:
  name: "vattenmatare-cam"
  platform: ESP32
  board: esp32dev  

# Enable logging
logger:

# Enable Home Assistant API
api:
    reboot_timeout: 0s

ota:

web_server:
  port: 80

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esp32-Cam Fallback Hotspot"
    password: "XXXXXXXXXXXXX"

captive_portal:

# Example configuration entry
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

  # Image settings
  name: My ESP32-CAM 

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

light:
  - platform: fastled_clockless
    rgb_order: GRB
    chipset: WS2812B
    pin: GPIO12
    num_leds: 12
    name: flashlight
    id: my_flashlight
    on_turn_on:
      then:
        - light.addressable_set:
            id: my_flashlight
            range_from: 0
            range_to: 5
            red: 100%
            green: 100%
            blue: 100%
        - delay: 11s
        - light.addressable_set:
            id: my_flashlight
            range_from: 0
            range_to: 11
            red: 0%
            green: 0%
            blue: 0%

I’ve replaced the ESP32 with another one but Ill get the same result.

Anyone who have an idea?

I think the problem is when you turn the light switch on,your turning all of them on and your “then” section, all its doing is setting the color for that range 0-5 Try adding a secodlnd range 6-×× that handles the remainder of the leds but give it 0% for each color

on_turn_on:
      then:
        - light.addressable_set:
            id: my_flashlight
            range_from: 0
            range_to: 5
            red: 100%
            green: 100%
            blue: 100%

       - light.addressable_set:
            id: my_flashlight
            range_from: 6
            range_to: 20?
            red: 0%
            green: 0%
            blue: 0%

There’s also a lot of documented issues that come up when using esp32-cam and lights at the same time. Most of the time I see them with using “dumb” PWM led’s but you may run into issues with addressable ones too. The camera is using a lot of the hardware capabilities of the esp32 and trying to use the clock or other hardware for 2 things at the same time will cause issues.