Change Color/Brightness on LED Strip Template Light through Alexa

Hello, I need help writing a template light entity for some under cabinet LED strips that are controlled via IR from a Broadlink Rm4 mini and the Broadlink integration. The lights have about twelve different color settings, each with a different remote command (red, green, blue, white, etc). They also have five different brightness settings, each with a unique remote button (I currently have them programmed as min, low, mid, high, max)

Here’s what I have so far:

light:
  - platform: template
    lights:
      under_cabinet_lights:
        friendly_name: "Under Cabinet Lights"
        turn_on:
          service: script.under_cabinet_lights_on
        turn_off:
          service: script.under_cabinet_lights_off
under_cabinet_lights_on:
  sequence:
  - service: remote.send_command
    target:
      entity_id: remote.wi_fi_ir_remote_remote
    data:
      device: Under Cabinet Lights
      command: 'on'
      num_repeats: 3
  mode: single
  alias: Under Cabinet Lights On
  icon: mdi:led-strip-variant

under_cabinet_lights_off:
  alias: Under Cabinet Lights Off
  sequence:
  - service: remote.send_command
    target:
      entity_id: remote.wi_fi_ir_remote_remote
    data:
      device: Under Cabinet Lights
      command: 'off'
      num_repeats: 3
  mode: single
  icon: mdi:led-strip-variant

In short, I’d like to figure out a way to template a service call for remote.send_command to set the brightness and color of the light. Anye help would be appreciated.

How are you going to interact with the light, switch/app/dashboard? If you wanted to set up a card you could use a input_select (drop down list) for the color. Use a input_number (slider) for the brightness.

You can use them in automations like so

alias: Kitchen Light Color
description: ''
trigger:
  - platform: state
    entity_id: input_select.drop_down
condition: []
action:
  - service: light.turn_on
    target:
      entity_id: light.1
    data:
      color_name: '{{ states( "input_select.drop_down" ) }}'
mode: single

If brightness is a number use
"{{ states('input_number.kitchen_brightness') | int }}"

Thank you. Sorry, I should have been more clear: I am already able to interact with it from the dashboard by using buttons that call the remote.send_command service with the appropriate command to set color and brightness. But I would like to also use it with the alexa integration to control brightness and color by voice. With my current template, I can only turn the light on or off. My problem is that I can’t figure out a way to define a color_template or level_template within my light template that would convert those inputs to the appropriate IR command. I think that your automation suggestion wouldn’t work for that reason: I need to first define how the light.turn_on service translates a particular color selection to the right IR command.

I just used light out of reflex talking about lights but it can be any service call triggered from the input_select

alias: Kitchen Light Color
description: ''
trigger:
  - platform: state
    entity_id: input_select.drop_down
    to: "blue"
condition: []
action:
  - service: remote.send_command
    target:
      entity_id: remote.wi_fi_ir_remote_remote
    data:
      device: Under Cabinet Lights
      command: 'command.for.blue'
mode: single

Now to set it up for alexa, from last I read was not straight forward. I have this thread bookmarked. You set up a dimmer in alexa and then set each step of the dimmer to a different command.

You should edit the title, these are not infrared lights and add alexa.

I edited the title per your suggestion and will take a look at that thread, thank you.

A clunky alternative that I just came up with would be to create scripts for each color and brightness change in HA, which would be exposed to Alexa as scenes, and create a new routine using a custom voice command for each setting to trigger the command. But that would require me to create like 20 different routines and would require an exact phrase as opposed to natural language, so it’s not ideal.