Pjoms
(Anders Westman)
December 10, 2023, 12:30pm
1
For my kitchen lights I have an idea to control four cwww analog led strips by using two dig2analog boards from QuinLED .
Each dig2analog board is controlled as an addressable SK6812 RGBW led with four independent pwm outputs that can handle 12/24V at 3A in total.
Now to my problem.
In esphome I would like to connect one Cold White + Warm White Light to the R and G channels and another “Cold White + Warm White Light” to the B and W channels of the addressable SK6812 RGBW (dig2analog).
My thought is something like this
Set up ESP32 RMT LED Strip “ as a string of two SK6812 RGBW
Use light.addressable_set Action to control the separate rgbw channels of each SK6812 (dig2analog)
One Cold White + Warm White Light to controls R+G in the “light.addressable_set Action”
A second “Cold White + Warm White Light” to controls B+W in the same “light.addressable_set Action”
The same thing goes for the second SK6812 (dig2analog)
The thing I don’t know how to solve, is the connection between the “Cold White + Warm White Light” that expects an output component, and the individual channels (r+g/b+w) in “light.addressable_set Action”.
Can this be solved by using template outputs , same lambda magic or is there maybe some different and better way to go this?
Edit: Links
Did you find a solution? I am facing the same issue.
Pjoms
(Anders Westman)
February 3, 2025, 3:38pm
3
Yes, I found a way that works really well for me.
It is a year since I touched the code now so memory tends to fade a little…
It basically looks like this:
The NeoPixelBus light component is used to control the dig2analog boards.
Four Template Outputs (cw1, ww1, cw2, ww2) are set up for the channels on each dig2analog (R,G,B,W)
Two cwww light components are attached to the Template Outputs to control each WWCW strip independently.
For the NeoPixelBus light component I have disabled the Gamma Correction by setting it to 1.0
For the wwcw light component I had to set the Gamma Correction to around 1.7
There is an old thread in led-setup-talk at the intermit.tech Discord as well with basically the same information.
Dig2analog controlling 2 x WWCW, or JAKL - Just Another Kitchen Light
Here are some code that should be quite close to what I’m using, except that I have two dig2analog boards, just duplicate and rename.
Hope it can be some help.
...
...
...
globals:
- id: cw1_save
type: float
initial_value: '0'
- id: ww1_save
type: float
initial_value: '0'
- id: cw2_save
type: float
initial_value: '0'
- id: ww2_save
type: float
initial_value: '0'
output:
- platform: template
id: cw1_out
type: float
write_action:
- lambda: id(cw1_save) = state;
- light.addressable_set:
id: dig2analog_string
range_from: 0
range_to: 0
red: !lambda return state;
green: !lambda return id(ww1_save);
blue: !lambda return id(cw2_save);
white: !lambda return id(ww2_save);
color_brightness: 100%
- platform: template
id: ww1_out
type: float
write_action:
- lambda: id(ww1_save) = state;
- light.addressable_set:
id: dig2analog_string
range_from: 0
range_to: 0
green: !lambda return state;
red: !lambda return id(cw1_save);
blue: !lambda return id(cw2_save);
white: !lambda return id(ww2_save);
color_brightness: 100%
- platform: template
id: cw2_out
type: float
write_action:
- lambda: id(cw2_save) = state;
- light.addressable_set:
id: dig2analog_string
range_from: 0
range_to: 0
blue: !lambda return state;
green: !lambda return id(ww1_save);
red: !lambda return id(cw1_save);
white: !lambda return id(ww2_save);
color_brightness: 100%
- platform: template
id: ww2_out
type: float
write_action:
- lambda: id(ww2_save) = state;
- light.addressable_set:
id: dig2analog_string
range_from: 0
range_to: 0
white: !lambda return state;
green: !lambda return id(ww1_save);
blue: !lambda return id(cw2_save);
red: !lambda return id(cw1_save);
color_brightness: 100%
light:
- platform: neopixelbus
type: WRGB
variant: SK6812
pin: GPIO16
num_leds: 1
id: dig2analog_string
# name: "Dig2analog string"
gamma_correct: 1.0
- platform: cwww
name: "Light 1 wwcw"
cold_white: cw1_out
warm_white: ww1_out
cold_white_color_temperature: 6500 K
warm_white_color_temperature: 2000 K
gamma_correct: 1.7
on_turn_on:
then:
- if:
condition:
light.is_off:
id: dig2analog_string
then:
- light.turn_on:
id: dig2analog_string
red: 1%
green: 1%
blue: 0%
white: 0%
color_brightness: 100%
transition_length: 0.1s
on_turn_off:
- lambda: id(cw1_save) = 0;
- lambda: id(ww1_save) = 0;
- platform: cwww
name: "Light 2 wwcw"
cold_white: cw2_out
warm_white: ww2_out
cold_white_color_temperature: 6500 K
warm_white_color_temperature: 2000 K
gamma_correct: 1.7
on_turn_on:
then:
- if:
condition:
light.is_off:
id: dig2analog_string
then:
- light.turn_on:
id: dig2analog_string
red: 0%
green: 0%
blue: 1%
white: 1%
color_brightness: 100%
transition_length: 0.1s
on_turn_off:
- lambda: id(cw2_save) = 0;
- lambda: id(ww2_save) = 0;
Pjoms
(Anders Westman)
February 3, 2025, 8:23pm
4
Here is my current configuration for two dig2analog boards that I use, controlling a total of four wwcw lights.
######################
### -- 4CH WWCW -- ###
### 2x Dig2Analog ###
### R=WW G=CW ###
### B=WW W=CW ###
######################
globals:
- id: cw11_save
type: float
initial_value: '0'
- id: ww11_save
type: float
initial_value: '0'
- id: cw12_save
type: float
initial_value: '0'
- id: ww12_save
type: float
initial_value: '0'
- id: cw21_save
type: float
initial_value: '0'
- id: ww21_save
type: float
initial_value: '0'
- id: cw22_save
type: float
initial_value: '0'
- id: ww22_save
type: float
initial_value: '0'
one_wire:
- platform: gpio
pin: GPIO13
sensor:
- platform: dallas_temp
name: "Styrbox Temperatur"
output:
### Dig2Analog 1 ###
- platform: template
id: ww11_out
type: float
write_action:
- lambda: id(ww11_save) = state;
- light.addressable_set:
id: dig2analog_string
range_from: 0
range_to: 0
red: !lambda return state;
green: !lambda return id(cw11_save);
blue: !lambda return id(ww12_save);
white: !lambda return id(cw12_save);
color_brightness: 100%
- platform: template
id: cw11_out
type: float
write_action:
- lambda: id(cw11_save) = state;
- light.addressable_set:
id: dig2analog_string
range_from: 0
range_to: 0
red: !lambda return id(ww11_save);
green: !lambda return state;
blue: !lambda return id(ww12_save);
white: !lambda return id(cw12_save);
color_brightness: 100%
- platform: template
id: ww12_out
type: float
write_action:
- lambda: id(ww12_save) = state;
- light.addressable_set:
id: dig2analog_string
range_from: 0
range_to: 0
red: !lambda return id(ww11_save);
green: !lambda return id(cw11_save);
blue: !lambda return state;
white: !lambda return id(cw12_save);
color_brightness: 100%
- platform: template
id: cw12_out
type: float
write_action:
- lambda: id(cw12_save) = state;
- light.addressable_set:
id: dig2analog_string
range_from: 0
range_to: 0
red: !lambda return id(ww11_save);
green: !lambda return id(cw11_save);
blue: !lambda return id(ww12_save);
white: !lambda return state;
color_brightness: 100%
### Dig2Analog 2 ###
- platform: template
id: ww21_out
type: float
write_action:
- lambda: id(ww21_save) = state;
- light.addressable_set:
id: dig2analog_string
range_from: 1
range_to: 1
red: !lambda return state;
green: !lambda return id(cw21_save);
blue: !lambda return id(ww22_save);
white: !lambda return id(cw22_save);
color_brightness: 100%
- platform: template
id: cw21_out
type: float
write_action:
- lambda: id(cw21_save) = state;
- light.addressable_set:
id: dig2analog_string
range_from: 1
range_to: 1
red: !lambda return id(ww21_save);
green: !lambda return state;
blue: !lambda return id(ww22_save);
white: !lambda return id(cw22_save);
color_brightness: 100%
- platform: template
id: ww22_out
type: float
write_action:
- lambda: id(ww22_save) = state;
- light.addressable_set:
id: dig2analog_string
range_from: 1
range_to: 1
red: !lambda return id(ww21_save);
green: !lambda return id(cw21_save);
blue: !lambda return state;
white: !lambda return id(cw22_save);
color_brightness: 100%
- platform: template
id: cw22_out
type: float
write_action:
- lambda: id(cw22_save) = state;
- light.addressable_set:
id: dig2analog_string
range_from: 1
range_to: 1
red: !lambda return id(ww21_save);
green: !lambda return id(cw21_save);
blue: !lambda return id(ww22_save);
white: !lambda return state;
color_brightness: 100%
light:
- platform: neopixelbus
type: WRGB
variant: SK6812
pin: GPIO16
num_leds: 2
id: dig2analog_string
# name: "Dig2analog string"
gamma_correct: 1.0
### Dig2Analog 1.1 ###
### R=WW G=CW ###
- platform: cwww
name: "Köksbänk Bardisk wwcw"
cold_white: cw11_out
warm_white: ww11_out
cold_white_color_temperature: 6500 K
warm_white_color_temperature: 2000 K
gamma_correct: 1.7
on_turn_on:
then:
- if:
condition:
light.is_off:
id: dig2analog_string
then:
- light.turn_on:
id: dig2analog_string
red: 1%
green: 1%
blue: 0%
white: 0%
color_brightness: 100%
transition_length: 0.1s
on_turn_off:
- lambda: id(cw11_save) = 0;
- lambda: id(ww11_save) = 0;
### Dig2Analog 1.2 ###
### B=WW W=CW ###
- platform: cwww
name: "Köksbänk Höger wwcw"
cold_white: cw12_out
warm_white: ww12_out
cold_white_color_temperature: 6500 K
warm_white_color_temperature: 2000 K
gamma_correct: 1.7
on_turn_on:
then:
- if:
condition:
light.is_off:
id: dig2analog_string
then:
- light.turn_on:
id: dig2analog_string
red: 0%
green: 0%
blue: 1%
white: 1%
color_brightness: 100%
transition_length: 0.1s
on_turn_off:
- lambda: id(cw12_save) = 0;
- lambda: id(ww12_save) = 0;
### Dig2Analog 2.1 ###
### R=WW G=CW ###
- platform: cwww
name: "Köksbänk Vänster wwcw"
cold_white: cw21_out
warm_white: ww21_out
cold_white_color_temperature: 6500 K
warm_white_color_temperature: 2000 K
gamma_correct: 1.7
on_turn_on:
then:
- if:
condition:
light.is_off:
id: dig2analog_string
then:
- light.turn_on:
id: dig2analog_string
red: 1%
green: 1%
blue: 0%
white: 0%
color_brightness: 100%
transition_length: 0.1s
on_turn_off:
- lambda: id(cw21_save) = 0;
- lambda: id(ww21_save) = 0;
### Dig2Analog 2.2 ###
### B=WW W=CW ###
- platform: cwww
name: "Köksbänk Spis Vänster wwcw"
cold_white: cw22_out
warm_white: ww22_out
cold_white_color_temperature: 6500 K
warm_white_color_temperature: 2000 K
gamma_correct: 1.7
on_turn_on:
then:
- if:
condition:
light.is_off:
id: dig2analog_string
then:
- light.turn_on:
id: dig2analog_string
red: 0%
green: 0%
blue: 1%
white: 1%
color_brightness: 100%
transition_length: 0.1s
on_turn_off:
- lambda: id(cw22_save) = 0;
- lambda: id(ww22_save) = 0;