Light template for zen31 CCT CW/WW strips

Hi There,

Hoping someone can point me in the right direction, I’ve searched a lot, and so far haven’t found an answer.

I am intending to mount a bunch of high CRI Tunable white LED light strips in my kitchen. These are white strips, with two channels, CW and WW (cool and warm white)
I also intend to use circadian lighting on these strips.

I’m struggling to find the best way to implement these in HA.
basic RGB strips are easy, lots of controllers out there (my preferred is the zooz zen31).
addressable LED strips… WLED. done.

I dont see any built-for-purpose controllers for just white LEDs, although the zen31 does list in it’s documentation you can assign a white strip to two of it’s four channels and use it as such. okay, so that’s the plan.
(unless someone out there can point to a zwave controller built for tunable white strips!!)

The question is… how do i hook that up and get it into homeassistant so it behaves like any other color temperature lite entity (such as hue bulbs, inovelli zwave bulbs, etc) where i can just give it a K value, and it translates that to the appropriate levels on the CW and WW channels?

I think the answer is a light template, but I’m not sure where to start. the zen31 does expose all for channels separately to HA, so there should be a way to template a white light and translate that to values on two channels. Also, do i have to manually figure out the conversion from color_temp to channel level, or is that something the template can do?

using zwaveJS2mqtt, my other thought is perhaps there is a way to load a custom device driver for a zen31 to make it behave and present to HA as a white light device. (total shot in the dark here…)


Trying to figure this out myself. (Two strips of tunable white LEDs. Both strips can share the power terminal with a pigtail. This leaves me R, G, B, & W to assign to CW(Strip 1), WW(Strip 1), CW(Strip 2), & WW (Strip 2).

Still digging. I’ll post back here once I solve this.

Hi @tarheelz I’m doing the same exact thing. I have tunable WW/CW LEDs in several locations with ZEN31s driving them. I have, as you did, the WW on one of the 4 outputs and CW on the other.

The key question, as you pointed out, is how to convert a particular color temperature to a given mix of brightness levels on the pair of output channels. This could then be implemented easily in Node-Red or other methods in HA. Did you ever figure out how to properly mix the CC & WW LEDs to achieve particular color temperatures?


Update… after LOTs of googling around, I found this article.

The input data for the article should be on your LED’s spec sheet (the ones I have includes it). Now, to try to decipher the article :-).

{EDIT} – I was able to install the referenced colour module and run the python code in VS. Next step, try to work the formulas backwards to derive the mixed % to get a given color temp.

Did you make progress on this. I’m in the exact same situation (WW/CW strip with Zen31). I figured a light template is the starting point to re-export the zwave JS light as a WW/CW light.

If you’re just going to linearly interpolate, this is what I came up with for a 2700K + 6500K LED strip from BTF. The warm white LED channel is connected to the W control channel and the cold white LED channel is connected to the B control channel. 370 mireds ~= 2700K and 154 mireds ~= 6500K.

  - platform: template
        unique_id: "cct_dimmer"
        friendly_name: "CCT Light"
        level_template: "{{ state_attr('light.rgbw_dimmer', 'brightness')|int }}"
        value_template: "{{ states('light.rgbw_dimmer') }}"
        temperature_template: "{{ (370 * (state_attr('light.rgbw_dimmer', 'rgbw_color')[3]/255.0) + 154 * (1.0 - state_attr('light.rgbw_dimmer', 'rgbw_color')[3]/255.0))|round }}"
        min_mireds_template: "{{ 154|int }}"
        max_mireds_template: "{{ 370|int }}"
          service: light.turn_on
            entity_id: light.rgbw_dimmer
          service: light.turn_off
            entity_id: light.rgbw_dimmer
          service: light.turn_on
            entity_id: light.rgbw_dimmer
            brightness: "{{ brightness }}"
          service: light.turn_on
            entity_id: light.rgbw_dimmer
            rgbw_color: "{{ (0, 0, ((1.0 - (color_temp - 154)/216)*255)|round|int, (((color_temp - 154)/216)*255)|round|int) }}"

well just wanted to say that light template works beautifully. I just hung up my first CCT white strip in the kitchen, and the HA controls are spot on…

Would you mind to share this. I also have CW/CC strip. (non-rgb) but still didn’t find a solution that I like.

Hi. Still on my to-do list, but I will certainly share it when I get there. In the meantime, I have a Zooz scene controller, and I’ve mapped two of the buttons with routines to toggle the WW and CW leds, so I can have CW, WW, or both on independently.

This template light worked great for me to convert my Zigbee RGBW LED strip controller into a CCT controller. I just had to change the channels of the light and put in some template light logic for when the LED strip was off and didn’t have any values:

 level_template: >-
           {% if  state_attr('light.led_strip', 'brightness') %}
             {{ state_attr('light.led_strip', 'brightness')|int(0) }}
             {{ 0 }}
        value_template: "{{ states('light.led_strip') }}"
        temperature_template: >-
           {% if  state_attr('light.led_strip', 'rgb_color') %}
             {{ (370 * (state_attr('light.led_strip', 'rgb_color')[1]/255.0) + 154 * (1.0 - state_attr('light.led_strip', 'rgb_color')[1]/255.0))|round }}
             {{ 300 }}


I got this working. I have two controllers that I want to control together with this. Is there a way I can ‘and’ a second controller in this or should I do a second template for the second light and then combine them both in a virtual switch? What is the best way to approach this?

Could this be combined with this: GitHub - gfrancesco/cwww-template-light-ha: Home Assistant template light to control cold-white / warm-white LED lights