Custom Button-Card: Is it possible to use color RGB() to create color from input_numbers?

I have some custom button-cards that let me toggle my RGB led strips. I would like to be able to set the current on color to the actual RGB color of the strips. I have three input numbers holding the values. Example.
input_number.kit_led_1_red
input_number.kit_led_1_grn
input_number.kit_led_1_blu

I can set the on color of the custom button card to a fixed color and it works fine. I don’t know how to create an rgb() color using input_numbers as variables. Is it possible? If so, what is wrong with my approach (see below)?

      - entity: light.kit_led_1
        name: Kitchen 1
        show_state: false
        state:
          - color: var(--disabled-text-color)
            icon: 'mdi:led-strip'
            value: 'off'
          - color: rgb(states['input_number.kit_led_1_red'].state,states['input_number.kit_led_1_grn'].state,states['input_number.kit_led_1_blu'].state)
            icon: 'mdi:led-strip'
            value: 'on'
        tap_action:
          action: call-service
          service: light.toggle
          service_data:
            entity_id: light.kit_led_1
        type: 'custom:button-card'

Thanks for any help!!

Easy…

Aaand, if those are generic rgb leds, then you could should be able to create rgb slider from the light entity’s attribute:

For light domain:

  • brightness - default
  • color_temp
  • hue
  • saturation
  • red
  • green
  • blue
  • effect
  • white_value

@kurniawan77

Thanks for the quick response and suggestion. Sorry, I am not very knowledgeable on how to reference values from other entities and use those values in another entity.

Unfortunately I don’t see how that will help me. I don’t need sliders, as I already have the information stored in each red , green, blue input number.

The LED lights are of type mqtt - json, if that matters.

What I need is an example of how to use those entities (input_number.kit_led_1_red, input_number.kit_led_1_grn, input_number.kit_led_1_blu) can be used in the RBG() function to set a custom color. I just don’t understand how to do that.

from the component above my automation for changing a light on the fly:

- id: dc9b5054d45444eba4b7afce05fb5f30
  alias: slideColorSet
  trigger:
  - platform: state
    entity_id: input_number.slidecolor_r
  - platform: state
    entity_id: input_number.slidecolor_g
  - platform: state
    entity_id: input_number.slidecolor_b
  - platform: state
    entity_id: input_number.slidecolor_level
  action:
  - service: light.turn_on
    data_template:
      entity_id: light.hallway
      rgb_color:
      - '{{ states.input_number.slidecolor_r.state | int }}'
      - '{{ states.input_number.slidecolor_g.state | int }}'
      - '{{ states.input_number.slidecolor_b.state | int }}'
      brightness: '{{ states.input_number.slidecolor_level.state | int }}'

so

'rgb({{ states.input_number.kit_led_1_red.state | int }}, {{ states.input_number.kit_led_1_green.state | int }}, {{ states.input_number.kit_led_1_blue.state | int }})'

im sure there is a better way(proper, cleaner, etc) but that should get you on the right track