issues icon indicating copy to clipboard operation
issues copied to clipboard

RGBWW light on ESP32 not restoring properly after reboot

Open PaoloTK opened this issue 2 years ago • 6 comments

The problem

When I restore the light I observe the following:

  • The RGB color and brightness are restored correctly
  • The cold and warm white channels aren't restored correctly: the cold white channel is set to 100%, the warm white channel is set to 0%.

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

PaoloTK avatar Jul 07 '23 20:07 PaoloTK

Samething with ESPHome 2023.7.0

anonyme22 avatar Jul 22 '23 17:07 anonyme22

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

anonyme22 avatar Jul 23 '23 11:07 anonyme22

Any news on this?

PaoloTK avatar Aug 12 '23 14:08 PaoloTK

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.

github-actions[bot] avatar Dec 11 '23 00:12 github-actions[bot]

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

PaoloTK avatar Dec 14 '23 20:12 PaoloTK

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.

Legot avatar Mar 13 '24 21:03 Legot