Having trouble with a NeoPixel

Hi,

I have been running ESPHome for a while and was using it to monitor the state of my home battery. A few months back, my code just stopped working (the LEDs do nothing) and I haven’t managed to work out what’s wrong with it.

Could someone please cast their eye over the code below and let me know what I’m doing wrong?
Just a couple of notes:

  • I am getting valid metrics from HA for the state of the battery.
  • I can’t get the LED ring to light up at all, unless I use the On/Off switch that’s in the Integrations view within HA (which proves that my wiring is correct).

I suspect my Lambda function is wonky somehow…

TIA

esphome:
  name: powerwall-charge
  friendly_name: PowerWall-Charge

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "3uPrg7z24b0acogeYdAa5PGZwLYMpFtWLIbkxvIb89g="

ota:
  password: "5181bf54d8269ffe1e21d25dce844299"

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Powerwall-Charge"
    password: "cbGiviI5u1o4"

captive_portal:
    


light:
  - platform: neopixelbus
    id: ringlight    
    type: GRB
    variant: WS2812
    pin: GPIO14
    num_leds: 24 #change this to the number of LEDS in your strip
    name: "NeoPixel LED Ring"
    effects:
      - addressable_lambda:
          name: "Battery level"
          lambda: |-
           const int leds_to_use=it.size();  // you can change that if you don't want all the leds to be used
           

            float battery_percentage = id(powerwall_charge).state;
            if (isnan(battery_percentage)) {
              battery_percentage = 0;
            }
            // number of leds that are drawn with full brightness
            int full_leds = int(leds_to_use*battery_percentage/100.0);
            // set those leds to the current_color of the light
            


            

            if (id(powerwall_status).state){

              Color blue(0,0,255);
              it[0] = blue;

            }
            else {
              Color blue_low(0,127,127);
             it[0] = blue_low;

            } 


            Color red(204,0,0); 
            it.range(1, 6) = red;
            Color orange(255,165,0);
            it.range(6,12) = orange;
            Color yellow(255,255,0);
            it.range(12,18) = yellow;
            Color green(0,255,0);
            it.range(18,24) = green;
            
           

            //set the remaing leds to black
            if (full_leds+1 < leds_to_use) {
              it.range(full_leds+1, leds_to_use) = ESPColor::BLACK; // change the color to something else if you want
            }
      


sensor:
  - platform: homeassistant
    id: powerwall_charge
    name: "Tesla Powerwall Charge"
    entity_id: sensor.powerwall_charge
binary_sensor:  
  - platform: homeassistant  
    id: powerwall_status
    name: "Tesla Powerwall Charge State"
    entity_id: binary_sensor.powerwall_charging

Did you try without it to see if the strip works correctly, then?