Problem with color interpolation during light transition

Hi all, I’m new to this framework and I’m essentially trying to control some rgb addressable strips.
I’d like to have color transitions, I’ve tried:

light:
  - platform: neopixelbus
    type: GRB
    variant: WS2812
    pin: GPIO14
    num_leds: 2
    name: "RGBLight"
    default_transition_length: 1s

as well as:

light:
  - platform: fastled_clockless
    chipset: WS2812
    pin: GPIO14
    num_leds: 2
    rgb_order: GRB
    name: "FastLED"
    default_transition_length: 1s

But in both cases the transition is not smooth, and is very noticiable if is like 5s long.
It kind of goes to black (not al the times, but often) and then quickly change to the expected color at the very end, even if this behavior is not consistant, and sometimes seems more smooth than others.
Im using an ESP32-Wroom and sendig this command via home assistant api:

{
  "entity_id": "light.esp32_test_fastled",
  "rgb_color": [0, 0, 255],
  "brightness": 255,
  "transition": 5
}

Not using any effects or automations at the moment, but in general I’d like to be able to create dynamic effects.

If two different libraries give both bad results on Esp32, I would look for hardware issue. How is your wiring?

The wiring is pretty simple:
VIN --------- STRIP+
GPIO14 — STRIP DATA
GND --------STRIP GND
But most importantly, the strip is only two leds, so minimal consumption.
And i tried a transition witha. lambda function:

light:
  - platform: neopixelbus
    type: GRB
    variant: WS2812
    pin: GPIO14
    num_leds: 2
    name: "RGBLight"
    id: "RGBLight"
    effects:
      - lambda:
          name: "TransitionRB_5S"
          update_interval: 20ms
          lambda: |-
            static float out = 0.0;
            static float duration = 5; // Duration in seconds
            static float totalSteps = duration / 0.02; // Total steps for 1-second transition
            static float increment = 1.0 / totalSteps;
            if(initial_run) out = 0.0;
            auto call = id(RGBLight).turn_on();
            call.set_transition_length(100);
            call.set_rgb(out, 0.0, 1.0-out);
            call.set_brightness(1.0);
            call.set_publish(false);
            call.set_save(false);
            call.perform();
            out += increment;
            if (out >= 1.0) {
            out = 1.0;
            increment = -increment;
            } else if (out <= 0.0) {
            out = 0.0;
            increment = -increment;
            }
            

It goes very smooth over the 5 seconds, so I don’t think it is an electrical problem.
The issue is that i want to be able to control the transition color and duration dynamically, just by sending a mqtt or an api request.

I’m open to any alternative, maybe WLED s a better approach?

The problem with that setup is that neopixel max VCC voltage is Vdata/0.7. So if your Esp32 has data line at 3.3V, Vin should be max 4.7V.
Ideally 5V supply and data trough level shifter. Even 3.3V supply voltage might work better.
Anyway, if it works with lambda, voltage level is probably not your problem.

What I’m wondering at this point is:

  1. are slow color-transitions known to be an issue with pixelneobus/fastled implementations?

  2. Is it possible to pass variables to a lambda function when invoked from mqtt of rhe home assistant rest-api (to set colors and duration)?

  1. no idea
  2. sure, use some component in the middle like global variable.

@piLeoni Curious what you ended up doing.

I have an ESP2866 based device (pre-made, so it should have the right supporting hardware, though I cannot be certain) that was working nicely with WLED for a while with a 72 LED strip. After a number of updates, and due to the older chip obviously, it started performing pretty bad.

I figured I’d give ESPHome a shot instead and use a basic neopixelbus based entity like you did above.

Funny enough I’m experiencing the same exact thing.

The transitions are really jerky, where sometimes the fade kind of “hitches” and often (but not always) it’s like the main LED of the previous color will turn all the way off so that the strip is basically black and then suddenly the other LED that is now relevant will pop on at the final light level.

I also noticed that sometimes the dot on the color picker in HA will snap back to the previous spot and then back again to where I set it during this transition. Makes me wonder if the hardware is just becoming flakey in general…