esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
290 stars 34 forks source link

Addressable Rainbow Effect uses white color with RGBW led strip #1830

Open benneq opened 3 years ago

benneq commented 3 years ago

Operating environment/Installation (Hass.io/Docker/pip/etc.):

ESP (ESP32/ESP8266, Board/Sonoff): ESP32 NodeMCU

ESPHome version (latest production, beta, dev branch)

1.16.0

Affected component:

light neopixelbus

Description of problem: When using Addressable Rainbow Effect with and RGBW LED strip it uses the white pixel which makes the effect look pale. The issue occurs when setting some RGBW colors and afterwards activating the Rainbow effect. Changing the white value (via code and/or Home Assistant Frontend) has no effect on this behavior.

Problem-relevant YAML-configuration entries:

globals:
   - id: brightness_up
     type: bool
     restore_value: no
     initial_value: 'true'

light:
  - platform: neopixelbus
    id: my_light
    variant: SK6812
    type: GRBW
    pin: GPIO23
    num_leds: 144
    name: "NeoPixel SK6812 Light"
    effects:
      addressable_rainbow:

binary_sensor:
  - platform: gpio
    name: "Button"
    id: my_sensor
    pin:
      number: GPIO15
      mode: INPUT_PULLDOWN
    on_multi_click:
      // single click to turn on / off the light
      // always turns on with rgbw(1, 0.75, 0, 0.3125)
      - timing:
          - ON for at most 0.25s
          - OFF for at least 0.25s
        then:
          - if:
              condition:
                light.is_off: my_light
              then:
                light.turn_on:
                  id: my_light
                  brightness: 50%
                  red: 100%
                  green: 75%
                  blue: 0%
                  white: 31.25%
              else:
                light.turn_off:
                  id: my_light
      // double click to switch between static rgbw and rainbow effect
      - timing:
          - ON for at most 0.25s
          - OFF for at most 0.25s
          - ON for at most 0.25s
          - OFF for at least 0.25s
        then:
          - lambda: |-
              auto call = id(my_light).make_call();
              if(id(my_light).get_effect_name() == "None") {
                call.set_white(0.0f);
                call.set_effect("rainbow");
              } else {
                float brightness;
                id(my_light).remote_values.as_brightness(&brightness);
                call.set_effect("none");
                call.set_rgbw(1.0f, 0.75f, 0.0f, 0.3125f);
              }
              call.perform();

Logs (if applicable):

[04:59:42][D][binary_sensor:036]: 'Button': Sending state ON
[04:59:42][D][binary_sensor:036]: 'Button': Sending state OFF
[04:59:43][D][binary_sensor:036]: 'Button': Sending state ON
[04:59:43][D][binary_sensor:036]: 'Button': Sending state OFF
[04:59:43][D][light:265]: 'NeoPixel SK6812 Light' Setting:
[04:59:43][D][light:287]:   Red=100%, Green=75%, Blue=0%
[04:59:43][D][light:290]:   White Value: 31%
[04:59:43][D][light:304]:   Transition Length: 1.0s
[04:59:43][D][light:310]:   Effect: 'None'
[04:59:46][D][binary_sensor:036]: 'Button': Sending state ON
[04:59:46][D][binary_sensor:036]: 'Button': Sending state OFF
[04:59:46][D][binary_sensor:036]: 'Button': Sending state ON
[04:59:47][D][binary_sensor:036]: 'Button': Sending state OFF
[04:59:47][D][light:265]: 'NeoPixel SK6812 Light' Setting:
[04:59:47][D][light:290]:   White Value: 0%
[04:59:47][D][light:327]:   Effect: 'Rainbow'

Additional information and things you've tried: Tried using call.set_white and call.set_rgbw. Tried to use those function calls with an additional call.perform right before activating the rainbow effect. Also tried to "unset" optional white using call.set_white({}). It has no effect. It will always give a pale rainbow because there's too much white color.

Rainbow effect only works fine when not setting / touching the white value.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

probot-esphome[bot] commented 3 years ago

light source light issues light recent changes (message by IssueLinks)

Ulrar commented 2 years ago

That's what it is, was wondering what was going on. You're right, it doesn't look great if white is cranked before selecting the effect, and reducing it after selecting the effect does nothing. Reducing white before selecting the effect works though, so that's a workaround at least