I gave up on fix the deprecation of RGBW light in `template.light` after 9 month being ignored

TLDR: This HACS repo add RGB, RGBW and RGBWW functionality to the light.template components: https://github.com/Vaarlion/HACS_home-assistant_template.light


Hi all !
I don’t know if Configuration is the right spot, i hesitated between it and Developments, but I’m here to share a HACS repo with a fix for the template.light component.

I don’t know if you noticed, but [a couple month ago](https://github.com/home-assistant/core/pull/76923)(sorry, 2 link limit for new user), the white_value attribute was fully removed from template.light service
The issue was that unlike MQTT light, they where no other way to control the white value of a RGBW light, the set_color and color_template attribute would only work for HS value :frowning:

I’m not a dev, but i used template light with RGBW light so i started to look into it. After month of reading about async, test, and how HA is written, I’ve made something I’m very proud off.

This Pull request add set_hs, set_rgb, set_rgbw and set_rgbww script to managed all type off light, and template_hs, template_rgb, template_rgbw and template_rgbww template to get the data for those light :slight_smile:
No breaking change, but it would be “best” IMO to change your template from set_color to set_hs and template_color to template_hs for readability :wink:
I’ve also push the test coverage to 100% ! Really proud of that.

Sadly, since January i haven’t got any input on it. Release goes by, rebase are sometime hard to do, and the fix i need for my home instance are just copy pasted… not clean. I understand that the core dev have a lot on their plate, sadly the more it wait the more work it is to keep it mergable.

So i decided to bite the bullet and try to make a HACS repo for it ! Now anyone can easily run the fixed version to, and as soon as a release go by i rebase it and the update show up in HACS !

Just add this https://github.com/Vaarlion/HACS_home-assistant_template.light custom repository and install the “Vaarlion template bugfix” component.

I hope this is a short fix, even the doc isn’t correct since the deprecation, but at least i would have done everything i could :smiley:

Here is an example that merge 2 segments and the master control of wled with RGBW led into a single light

light:
  - platform: template
    lights:
      wled_global:
        unique_id: 28208f257b54c44e50deb2d618d44710
        friendly_name: "Multi-segment Wled control"
        value_template: "{{ states('light.wled_master') }}"
        level_template: "{{ state_attr('light.wled_master', 'brightness')|d(0,true)|int }}"
        rgbw_template: (
          {{ (state_attr('light.wled_segment_0', 'rgbw_color')[0]|d(0) + state_attr('light.wled_segment_1', 'rgbw_color')[0]|d(0))/2 }},
          {{ (state_attr('light.wled_segment_0', 'rgbw_color')[1]|d(0) + state_attr('light.wled_segment_1', 'rgbw_color')[1]|d(0))/2 }},
          {{ (state_attr('light.wled_segment_0', 'rgbw_color')[2]|d(0) + state_attr('light.wled_segment_1', 'rgbw_color')[2]|d(0))/2 }},
          {{ (state_attr('light.wled_segment_0', 'rgbw_color')[3]|d(0) + state_attr('light.wled_segment_1', 'rgbw_color')[3]|d(0))/2 }}
          )
        effect_list_template: "{{ state_attr('light.wled_segment_0', 'effect_list') }}"
        effect_template: "{{ state_attr('light.wled_segment_0', 'effect') if state_attr('light.wled_segment_0', 'effect') == state_attr('light.wled_segment_1', 'effect') else none }}"
        availability_template: "{{ not is_state('light.wled_master', 'unknown') }}"
        turn_on:
          service: light.turn_on
          entity_id: light.wled_segment_0, light.wled_segment_1, light.wled_master
        turn_off:
          service: light.turn_off
          entity_id: light.wled_master
        set_level:
          service: light.turn_on
          entity_id: light.wled_master
          data_template:
            brightness: "{{ brightness }}"
        set_rgbw:
          service: light.turn_on
          entity_id: light.wled_segment_0, light.wled_segment_1
          data_template:
            rgbw_color:
              - "{{ r }}"
              - "{{ g }}"
              - "{{ b }}"
              - "{{ w }}"
            effect: "Solid"
        set_effect:
          service: light.turn_on
          entity_id: light.wled_segment_0, light.wled_segment_1
          data_template:
            effect: "{{ effect }}"

Please tell me if you used it ! it would make me so happy :smiley:

2 Likes

Moved to Custom integrations

Rebase for 2023.5.2v1 have been uploaded !

Have you been in touch with someone like Frank or Balloob? I really don’t understand why there’s still not even a reply since Jan.

I’ve been running into the same issue ever since they dropped the white_value on multiple instances and had to fiddle around with custom automations and number_values, but I’d like to unify it as it was possible before.

Thanks for your work so far, the code looks good to me!

Just a poke to reminde that i still update that HACS version, but only when I upgrade my HA witch is mostly alwayse 1 release back from release.
Today 2023.9 is up, but upgrading require a force restart as other file in the template integration was updated on source and i can’t just provide the light part.

Have you been in touch with someone like Frank or Balloob

Yes Frank, got the cold shoulder.

I might sound paranoiac or egocentric, but i believe i got flagged as a douche-bag by him after making a PR increasing the version of zwave-js on his addon without testing or validating anything.
Before that he opened change request on the template one. After that, no more reply.
I hesitate a lot before directly pinging him again yet without reply. I also tried to get info from the dev section of the discord about what could be blocking this… nothing either.

I know there is a lot of work from the core dev and i was willing to wait my turn. But given the broken aspect of the doc of this integration right now, and that i have pinged for help on this many time… over 9 month.

As of now, I’m forbidding myself to work on any other Home assistant issue, including ssl for fullykiosk and some documentation issue, because i don’t want them to be block only because i’ve done them.

I’m honestly waiting for someone else to do the same, and to be merged the same month…

1 Like

Hi Vaarlion. Sorry you’ve been waiting 10 months now to get someone to review your HA code submission. That sucks.

I’m using your HACS version and it works much better than the HA built-in Light Template. Just wanted to say Thanks!!!

1 Like

Thank you very much.
It’s very validating to know someone else use this, event if you are the fist.

And don’t hesitate to ask if you need an updated version sooner than i do :slight_smile:

Release for home assistant 2023.10.5

Ok, A BIG change was introduced to the template integration, Config flow, and since this was never merged it completely skipped all of the change i’ve done.
I would need to spend a lot of time learning about config flow, what was changed and how to integrate that.

I’m not doing it. I had enough.
If this wasn’t merged in 9 months, it will probably never be and it’s not something HA want to see fix.

I’m dropping this issue and won’t be working on it anymore.
Feel free to do whatever you want with what’s left

well, it’s in Full changelog for Home Assistant Core 2023.12 - Home Assistant so …
Look like it was merged in the end, i hop they manage to refactor :person_shrugging:

i feel odd about it, That i had to give up on it in order to have anything move…
But the end result is the same, and it should be a good thing

1 Like

Congrats on getting this merged! Sorry you had to abandon it to make it happen.

I also assumed it would never get included. Still very happy with your fix and extra happy to see it’s official.

1 Like