esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
294 stars 37 forks source link

RGBWW light on ESP32 not restoring properly after reboot #4674

Open PaoloTK opened 1 year ago

PaoloTK commented 1 year ago

The problem

When I restore the light I observe the following:

No matter what I have the cold and warm white channels set to, if they're at 0%, 100% or 32%, they always get restored CW at 100% and WW at 0% after reboot.

Which version of ESPHome has the issue?

2023.6.4

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

2023.7

What platform are you using?

ESP32

Board

Quinled-Esp32

Component causing the issue

RGBWW Light

Example YAML snippet

light:
  - platform: rgbww
    name: ${friendly_name}
    restore_mode: RESTORE_DEFAULT_OFF 
    id: rgbcct
    icon: "mdi:led-strip"
    red: pwm_r
    green: pwm_g
    blue: pwm_b
    cold_white: pwm_cw
    warm_white: pwm_ww
    cold_white_color_temperature: 6500 K
    warm_white_color_temperature: 2200 K

Anything in the logs that might be useful for us?

No response

Additional information

No response

anonyme22 commented 1 year ago

Samething with ESPHome 2023.7.0

anonyme22 commented 1 year ago

This issues happen on PWM and SM2135 light.

light:
  - platform: rgbww
    restore_mode: RESTORE_DEFAULT_OFF
    # color_mode: RGB_COLD_WARM_WHITE
    default_transition_length: 0s
    name: $name
    red: output_red
    green: output_green
    blue: output_blue
    cold_white: output_cwhite
    warm_white: output_wwhite
    cold_white_color_temperature: 6536 K
    warm_white_color_temperature: 2000 K

output:
  - platform: esp8266_pwm
    id: output_red
    pin: GPIO4
    max_power: 80%

  - platform: esp8266_pwm
    id: output_green
    pin: GPIO12
    max_power: 80%

  - platform: esp8266_pwm
    id: output_blue
    pin: GPIO14
    max_power: 80%

  - platform: esp8266_pwm
    id: output_cwhite
    pin: GPIO5
    max_power: 80%

  - platform: esp8266_pwm
    id: output_wwhite
    pin: GPIO13
    max_power: 80%

And

light:
  - platform: rgbww
    restore_mode: RESTORE_DEFAULT_OFF
    # color_mode: RGB_COLD_WARM_WHITE
    default_transition_length: 0s
    name: $name
    red: output_red 
    green: output_green 
    blue: output_blue 
    cold_white: output_white 
    warm_white: output_warmwhite 
    cold_white_color_temperature: 6536 K
    warm_white_color_temperature: 2000 K

sm2135:
  data_pin: GPIO14
  clock_pin: GPIO4

# Individual outputs
output:
  - platform: sm2135
    id: output_red
    channel: 2
    max_power: 0.8
  - platform: sm2135
    id: output_green
    channel: 0
    max_power: 0.8
  - platform: sm2135
    id: output_blue
    channel: 1
    max_power: 0.8
  - platform: sm2135
    id: output_white
    channel: 3
    max_power: 0.8
  - platform: sm2135
    id: output_warmwhite
    channel: 4
    max_power: 0.8
PaoloTK commented 1 year ago

Any news on this?

github-actions[bot] commented 11 months 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.

PaoloTK commented 11 months ago

Won't be able to test at the moment, not sure if bug has been fixed. Any chance you can confirm @anonyme22 ?

Legot commented 8 months ago

Still seeing this issue on ESPHome 2024.2.2, using the bp5758d platform.

For a temporary fix I've enabled the color_interlock, the downside is that that disables mixing of the RGB and CW/WW channels, so when changing between the color and color temperature modes the light goes off for the transition time.

light:
  - platform: rgbww
    name: "RGBWW"
    red: output_red
    green: output_green
    blue: output_blue
    cold_white: output_cool
    warm_white: output_warm
    cold_white_color_temperature: 6500 K
    warm_white_color_temperature: 2700 K

    color_interlock: True # See issue https://github.com/esphome/issues/issues/4674, WW and CW channels do not restore correctly without color interlock
    restore_mode: RESTORE_DEFAULT_ON #Restore to previous state, otherwise restore to ON

It's not causing any issues regarding thiss issue, but I want to mention I am using a light with a Tuya CB2L module (BK7231N) so to save the state in flash memory I did define the flash write interval manually.

preferences:
  flash_write_interval: 1min #This is required for the cb2l to restore the light state after rebooting.

In the logs (regardless of the color_interlock setting) I see

[15:20:37][D][light:036]: 'RGBWW' Setting:
[15:20:37][D][light:051]:   Brightness: 52%
[15:20:37][D][light:085]:   Transition length: 1.0s

[15:21:11][D][lt.preferences:104]: Saving 1 preferences to flash...
[15:21:11][D][lt.preferences:132]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed

I'm thinking that the RGBWW platform is just a mash up of the RGB platform and the CWWW platform rather than a complete rewrite.

So my guess is that the fix would involve having the RGBWW platform write two states, one for RGB and one for CWWW. Currently it looks like only the state for RGB is being written.

brotaxt commented 3 months ago
preferences:
  flash_write_interval: 1min #This is required for the cb2l to restore the light state after rebooting.

This fixed the problems for me too. Thank you very much!

I am a little surprised though, as this value seems to be the default anyway!?

Adjusting flash writes

# Example configuration entry
preferences:
flash_write_interval: 1min

flash_write_interval (Optional, Time): Customize the frequency in which data is flushed to the flash. This setting helps to prevent rapid changes to a component from being quickly written to the flash and wearing it out. Defaults to 1min.

source: https://esphome.io/components/esphome.html