RGBW - templating

Hi there,

I’m looking for someone who’s good in templating :slight_smile:

I’ve got RGBW led strip connected as 4 different inputs. I’d like to combine them so I can use color palette eg. GitHub - ljmerza/light-entity-card: Control any light or switch entity

This looks like something I am looking for:

As I understand, that’s what templating for. So I can combine things and let them become another entity so generic cards etc. would undederstand them.

Best regards,
K.M.

Explain how your four strips work. What are their entity IDs, and what settings can you adjust?

Hey @Troon, each entity represents different color (RGBW). I can change only their brightness.

My entities:
light.red
light.green
light.blue
light.white

Physically it’s the same led strip. so eg. if I max red and green then I get led strip yellow :slight_smile:

I would like to combine this into ‘single entity’ which supports RGBW and color palette.

I’ve done something like this so far:

light:
  - platform: template
    lights:
      rgbw:
        friendly_name: "rgbw"
        rgb_template: (
          {{ state_attr('light.kwadrat_kuchnia_red', 'brightness')  }},
          {{ state_attr('light.kwadrat_kuchnia_green', 'brightness') }},
          {{ state_attr('light.kwadrat_kuchnia_blue', 'brightness') }}
          )
        turn_on:
          service: light.turn_on
          entity_id: light.kwadrat_kuchnia_red, light.kwadrat_kuchnia_green, light.kwadrat_kuchnia_blue
        turn_off:
          service: light.turn_off
          entity_id: light.kwadrat_kuchnia_red, light.kwadrat_kuchnia_green, light.kwadrat_kuchnia_blue
        set_rgb:
          service: light.turn_on
          entity_id: light.kwadrat_kuchnia_red, light.kwadrat_kuchnia_green, light.kwadrat_kuchnia_blue
          data:
            rgbw_color:
              - "{{ state_attr('light.kwadrat_kuchnia_red', 'brightness')  }}"
              - "{{ state_attr('light.kwadrat_kuchnia_green', 'brightness') }}"
              - "{{ state_attr('light.kwadrat_kuchnia_blue', 'brightness') }}"
            effect: "Solid"

This let’s me all 4 colors to be turned on or off. However, I don’t know yet how to pass selected color from the gui to make led strip light this color.

You need the set_rgb call to be three separate light.turn_on calls, with the brightness set to the appropriate colour value.

…or use set_rgbw and four calls. Something like this, perhaps:

      set_rgbw:
        - service: light.turn_on
          entity_id: light.kwadrat_kuchnia_red
          data:
            brightness: "{{ r }}"
        - service: light.turn_on
          entity_id: light.kwadrat_kuchnia_green
          data:
            brightness: "{{ g }}"
        - service: light.turn_on
          entity_id: light.kwadrat_kuchnia_blue
          data:
            brightness: "{{ b }}"
        - service: light.turn_on
          entity_id: light.kwadrat_kuchnia_white
          data:
            brightness: "{{ w }}"

Thx. I’ve pasted entire snippet here Dimmable RGBW leds, each color separate source - #4 by krismarc