I may have discovered a bug in the cwww component.
I have 5 cwww lights running ESPHome which reboot themselves approx. every 5-6 minutes when set to midrange color-temperature and brightness values (e.g. 25% bright, 4000K).
Suspecting power problems, I added large caps to the 24v and 5V bus, no improvement. Ocilloscope traces confirm that the 5V bus is rock-solid.
A spare ESP8266 (a lolin d1_mini) - that was connected to nothing but a USB cable for the serial log - was also affected, which told me the problem had to be in software or an inherent characteristic of the 8266. Unable to pursue the latter, I went for the former.
Logs show:
rst cause:4, boot mode:(3,6)
wdt reset
The devices are stable at either end of the color/brightness ranges - they only self-reset when the colors were about equal.
So, I looked around and found that the call shown below may āfeedā the watchdog timer sufficiently to prevent the random rebooting.
esphome:
on_loop:
then:
- lambda: |-
ESP.wdtFeed(); return;
After adding the call to WDT, the devices have remained reboot-free for 18 hours. Previously they could not last beyond a sunset/sunrise, when the circadian code in HA sets them to the troublesome midranges of color & brightness.
Here is the relevant portion of the deviceās config:
light:
- platform: cwww
name: ${node_name}
id: the_light
cold_white: output_cool_leds
warm_white: output_warm_leds
cold_white_color_temperature: 6024 K
warm_white_color_temperature: 2700 K
default_transition_length: 1s
constant_brightness: true
output:
- platform: esp8266_pwm
id: output_warm_leds
pin: GPIO5
inverted: false
- platform: esp8266_pwm
id: output_cool_leds
pin: GPIO4
inverted: false
So, while this workaround seems to suffice for me, I wonder if I should submit this as a bug in the cwww component of ESPHome?