Light helper can't change color of Hue Bulb

Hello,

I created a light helper to control a Hue bulb.
The On/Off, brightness, and color temperature functions work, but changing the color itself does not.

In “Actions on set HS color,” I entered:

action: light.turn_on
target:
  entity_id: light.hue_couloir
data:
  rgb_color: "{{ rgb_color }}"

But as soon as I choose a color on the color picker, I get the error:

Failed to perform the action light/turn_on. None for dictionary value @ data[‘rgb_color’]

I tried the same thing with hs_color but got the same result.

How can I make it work?

What is defined as rgb_color in your light helper? Please define light helper.

Does this work?

action: light.turn_on
metadata: {}
data:
  rgb_color:
    - 240
    - 15
    - 15
target:
  entity_id: light.hue_couloir

Yes, your code work. In fact I never used a light helper via the UI.
I just want the bulb to take the color I choose on the color picker.
I made this for the level:

target:
  entity_id: light.hue_couloir
data:
  brightness: "{{ brightness }}"
action: light.turn_on

and this for the temperature:

target:
  entity_id: light.hue_couloir
data:
  color_temp: "{{ color_temp }}"
action: light.turn_on

Both seems to work but not the color.

What we are saying is you have to either define those variables (correctly) or instead use valid hard values instead of variable names.

RGB is a list of 3 values 0 to 255.
[123,234,0] and if it is giving you problems, you may have to cast it with an additional |list.

I succeeded with:

action: light.turn_on
target:
  entity_id: light.hue_couloir
data:
  hs_color:
    - "{{ hs[0] }}"
    - "{{ hs[1] }}"

I created this:

With these parameters:

Perhaps I didn’t express my request clearly, but in any case, it’s working now.
Thanks for your help.

1 Like