Template to split a RGB and color temp light into 2 separate entities

Apologies if this has ever been brought up before, but I couldn’t seem to find a related post.
I have a Razer Aether Monitor Bar light which is connected via Matter. This light has brightness, RGB, and color temp in one entity by default. I made a template in my configuration to split that into 2 separate entities, one for RGB and one for color temp. The color temp entity has brightness control but with this light connected VIA matter the RGB portion does not have separate brightness control.
My first attempt used this configuration:

light:
  - platform: template
    lights:
      razer_aether_rgb:
        friendly_name: "Razer Aether RGB"
        value_template: "{{ is_state('light.razer_aether_monitor_bar', 'on') }}"
        level_template: "{{ state_attr('light.razer_aether_monitor_bar', 'brightness') }}"
        turn_on:
          action: light.turn_on
          target:
            entity_id: light.razer_aether_monitor_bar
          data:
            rgb_color: [255, 255, 255] # White color
        turn_off:
          action: light.turn_off
          target:
            entity_id: light.razer_aether_monitor_bar
        set_rgb:
          action: light.turn_on
          target:
            entity_id: light.razer_aether_monitor_bar
          data_template:
            rgb_color: "{{ rgb_color }}"

      razer_aether_color_temp:
        friendly_name: "Razer Aether Color Temperature"
        value_template: "{{ is_state('light.razer_aether_monitor_bar', 'on') }}"
        level_template: "{{ state_attr('light.razer_aether_monitor_bar', 'brightness') }}"
        turn_on:
          action: light.turn_on
          target:
            entity_id: light.razer_aether_monitor_bar
          data:
            color_temp: 250 # Color temperature
        turn_off:
          action: light.turn_off
          target:
            entity_id: light.razer_aether_monitor_bar
        set_level:
          action: light.turn_on
          target:
            entity_id: light.razer_aether_monitor_bar
          data_template:
            brightness: "{{ brightness }}"
        set_temperature:
          action: light.turn_on
          target:
            entity_id: light.razer_aether_monitor_bar
          data_template:
            color_temp: "{{ color_temp }}"

This worked for the color temp entity but the RGB entity kept throwing an error for “rgb_color” not being defined.
I’ve created a work around for now, I use a text helper instead and have an automation to change the origional entity rgb_color when the text helper changes. Does anyone know why the first method doesn’t work?

light:
  - platform: template
    lights:
      razer_aether_rgb:
        friendly_name: "Razer Aether RGB"
        value_template: "{{ is_state('light.razer_aether_monitor_bar', 'on') }}"
        turn_on:
          action: light.turn_on
          target:
            entity_id: light.razer_aether_monitor_bar
        turn_off:
          action: light.turn_off
          target:
            entity_id: light.razer_aether_monitor_bar
        set_rgb:
          action: light.turn_on
          target:
            entity_id: light.razer_aether_monitor_bar
          data_template:
            rgb_color: "{{states('input_text.razer_rgb_color')}}"

      razer_aether_color_temp:
        friendly_name: "Razer Aether Color Temperature"
        value_template: "{{ is_state('light.razer_aether_monitor_bar', 'on') }}"
        turn_on:
          action: light.turn_on
          target:
            entity_id: light.razer_aether_monitor_bar
          data:
            color_temp: 250 # Color temperature
        turn_off:
          action: light.turn_off
          target:
            entity_id: light.razer_aether_monitor_bar
        set_level:
          action: light.turn_on
          target:
            entity_id: light.razer_aether_monitor_bar
          data_template:
            brightness: "{{ brightness }}"
        set_temperature:
          action: light.turn_on
          target:
            entity_id: light.razer_aether_monitor_bar
          data_template:
            color_temp: "{{ color_temp }}"

Why?

I have automations and scripts that can change RGB entities automatically but need to split the brightness apart otherwise the color temp portion also changes brightness with them.

I don’t have first-hand experience, but according to Template Light - Home Assistant, you get individiual r, g, b variables, not rgb_color

Thanks, this template works now.

light:
  - platform: template
    lights:
      razer_aether_rgb:
        friendly_name: "Razer Aether RGB"
        value_template: "{{ is_state('light.razer_aether_monitor_bar', 'on') }}"
        turn_on:
          action: light.turn_on
          target:
            entity_id: light.razer_aether_monitor_bar
        turn_off:
          action: light.turn_off
          target:
            entity_id: light.razer_aether_monitor_bar
        set_rgb:
          action: light.turn_on
          target:
            entity_id: light.razer_aether_monitor_bar
          data_template:
            rgb_color: "{{rgb}}"