La vidéo
Le schéma

Le code
esphome:
name: esp_lampe_rgb
platform: ESP8266
board: d1_mini
wifi:
ssid: "WIFI"
password: "Motdepasse"
captive_portal:
logger:
api:
ota:
output:
- platform: esp8266_pwm
id: red
pin: D5
- platform: esp8266_pwm
id: green
pin: D6
- platform: esp8266_pwm
id: blue
pin: D7
- platform: esp8266_pwm
id: white
pin: D8
light:
- platform: rgbw
name: "Lampe RGB"
id: strip
red: red
green: green
blue: blue
white: white
effects:
- random:
- strobe:
- flicker:
- lambda:
name: RGB
update_interval: 3s
lambda: |-
static int state = 0;
auto call = id(strip).turn_on();
// Transtion of 1000ms = 1s
call.set_transition_length(1000);
if (state == 0) {
call.set_rgb(0.0, 0.0, 1.0);
} else if (state == 1) {
call.set_rgb(0.0, 1.0, 1.0);
} else if (state == 2) {
call.set_rgb(0.0, 1.0, 0.0);
} else if (state == 3) {
call.set_rgb(1.0, 1.0, 0.0);
}else if (state == 4) {
call.set_rgb(1.0, 0.0, 0.0);
}else if (state == 5) {
call.set_rgb(1.0, 0.0, 1.0);
}
else {
call.set_rgb(1.0, 1.0, 1.0);
}
call.perform();
state += 1;
if (state == 7)
state = 0;