šŸ’” Lovelace: RGB light card

Is it possible to combine a linear gradient background with the MDI icons?

Of course!

In my icon tool, replace the Background color with a linear gradient.

For example, here is the result with linear-gradient(45deg, #ff64b6, #ffda82 ):

Perfect - I missed the comma in my attempts! Thanks.

Let me start by thanking you for this card. Been in use for the girls bedrooms and they love it. :smiley:
Now either iā€™m overlooking it or its not possible (for now). But how would an end user set the colors for the buttons? Right now i have to do it in the code editor but thats not something iā€™m willing to let them do it.

Something like a long press on the color would set it to the current RGBW values?

Sorry but I donā€™t think a Lovelace card can store data or change its own configurationā€¦

If Iā€™m wrong, please correct me and Iā€™ll be happy to implement this feature! :+1:

My Shelly RGBW2 runs an RGBW strip. If I specify an RGB color, the icon shows the correct color. If I specify an RGBW color, the icon is always medium gray, no matter what color I set.

                  - label: Shows correct color
                    rgb_color:
                      - 255
                      - 85
                      - 0
                    effect: 0
                    transition: 1
                  - label: Shows medium gray
                    rgbw_color:
                      - 255
                      - 85
                      - 0
                      - 150
                    effect: 0
                    transition: 1

FWIW, when I choose an RGBW color, the lightbulb icon for the entity shows the correct color, so I can always grab that color from the screen and set it manually if I need to.

hello I really like this card, does the HA code go into the yaml configuration?
Regards

Just installed your card in all my rooms and want to say: thank you very much! This is just fabulousā€¦

Is it possible to set a group of lights, where every light in the set gets its own color, brightness etc.? Such as HUE scenes?

Regards

You can create a Home Assistant scene, then turn on this scene using the RGB Light Card, like this:

type: entities
entities:
- type: custom:rgb-light-card
  colors:
  - type: call-service
    service: scene.turn_on
    service_data:
      entity_id: scene.your_scene # <- id of your scene here

Thank you for your help!

Is there a way to create a scenario/effect with rgb_colors like ā€œwaveā€ from left to right on the led strip from one color to another one?

HI! I canā€™t get kelvin or color_temp to work with below config, throws error below:

Failed to call service light/turn_on. two or more values in the same group of exclusion 'Color descriptors' @ data[<Color descriptors>]

type: entities
show_header_toggle: false
state_color: true
entities:
  - type: custom:slider-entity-row
    entity: light.axels_vagglampa
    name: VƤgglampa
    toggle: true
    icon: mdi:wall-sconce
  - type: custom:rgb-light-card
    entity: light.axels_vagglampa
    hide_when_off: false
    justify: around
    colors:
      - rgb_color:
          - 251
          - 180
          - 139
        brightness: 200
        color_temp: 359
        transition: 1
      - rgb_color:
          - 255
          - 0
          - 0
        brightness: 255
        transition: 1
      - rgb_color:
          - 183
          - 225
          - 238
        brightness: 200
        transition: 1
      - rgb_color:
          - 0
          - 0
          - 255
        brightness: 200
        transition: 1
      - rgb_color:
          - 0
          - 255
          - 0
        brightness: 200
        transition: 1
      - rgb_color:
          - 255
          - 0
          - 255
        brightness: 200
        transition: 1

Iā€™m a noob on this card, but Iā€™m not sure it is okay to have two different color setting commands in the same section.

Correct, figured that out the moment your posting was made :smiley: Thx! Thought I could combine temp with color.

Is there a way to get the colors button to pop up a color wheel or go the color selector in more-info? I know I can do it by clicking on the icon then clicking the color tab but it would be nice if I could do it in a single click.

Does RGB Light Card work with variables? I want to use a variable for the brightness of the light (and ideally variables for more values). Any way to make this work? Or is this a current limitation of the card?

This doesnā€™t work:

type: entities
show_header_toggle: false
entities:
  - type: custom:rgb-light-card
    entity: light.inside
    size: 50
    colors:
      - hs_color:
          - 1
          - 100
        brightness: {{ states("input_number.light_scene_brightness") | int }}
        transition: 1

This doesnā€™t work either:

{{ states.input_number.light_scene_brightness.state | int }}

Either way, cool card. Thank you for making it.

Worst case I could setup a script for each color and put the variables in there.

Hello,

No, the card doesnā€™t support templates, youā€™ll have to write scripts

Have a great day!

Thank you for the answer, @bokub

Ended up using a script:

When you select a color, it passes a named color variable (called ā€˜colornameā€™) to a script called ā€˜Inside Colorā€™. This script sets a helper called input_text.light_scene to the name of the color. A final activate script then uses this and other settings to actually change the light. This final script can be called again to set the lights to the last selected color.

type: entities
show_header_toggle: false
entities:
  - type: custom:rgb-light-card
    entity: light.inside
    size: 50
    colors:
      - type: call-service
        service: script.inside_color
        service_data:
          colorname: red
        icon_color: red
      - type: call-service
        service: script.inside_color
        service_data:
          colorname: orange
        icon_color: orange
      - type: call-service
        service: script.inside_color
        service_data:
          colorname: yellow
        icon_color: yellow
      - type: call-service
        service: script.inside_color
        service_data:
          colorname: green
        icon_color: green
      - type: call-service
        service: script.inside_color
        service_data:
          colorname: blue
        icon_color: blue
      - type: call-service
        service: script.inside_color
        service_data:
          colorname: indigo
        icon_color: indigo

And the script called by the RGB light card that sets the variables.

alias: Inside Color
sequence:
  - service: input_text.set_value
    data:
      value: "{{ colorname }}"
    target:
      entity_id: input_text.light_scene
  - service: input_select.select_option
    data:
      option: colornametype
    target:
      entity_id: input_select.light_scene_type
  - service: script.inside_scene_activate
    data: {}
mode: single
icon: mdi:palette-outline

Inside Scene Activate script

alias: Inside Scene Activate
sequence:
  - choose:
      - conditions:
          - condition: state
            entity_id: input_select.light_scene_type
            state: colornametype
        sequence:
          - service: light.turn_on
            data:
              color_name: "{{ states.input_text.light_scene.state }}"
              brightness: "{{ states.input_number.light_scene_brightness.state }}"
              transition: 1
            target:
              entity_id: light.inside
mode: single
icon: mdi:lamps

Fixed for now by removing the brightness part from rgb_color:ā€¦if their is somthing Iā€™m missing help me outout
Hi can somone help me whatā€™s wrong with this code:
On click itā€™s not changing any color

type: custom:rgb-light-card
entity: light.bedroom_lamp
justify: center
size: 26
colors:
  - rgb_color:
      - 255
      - 170
      - 0
    brightness: 255
    icon_color: linear-gradient(15deg, rgb(255,170,0), rgb(255,225,165)
  - rgb_color:
      - 255
      - 0
      - 0
    brightness: 255
    icon_color: linear-gradient(15deg, red, rgb(255,100,100))
  - rgb_color:
      - 244
      - 38
      - 255
    brightness: 255
    icon_color: linear-gradient(15deg, rgb(244,38,255), rgb(255,138,255))
  - rgb_color:
      - 0
      - 222
      - 255
    brightness: 255
    icon_color: linear-gradient(15deg, rgb(0,222,255), rgb(140,240,255))
  - rgb_color:
      - 0
      - 0
      - 255
    brightness: 255
    icon_color: linear-gradient(15deg, blue, rgb(100,100,255))