RGB Light Script Errors

I am trying to create a script to turn on an RGB light and set the brightness and color temperature based on two helper input_select dropdowns. When I reference them, I keep getting object errors. Here are the details:

One of the dropdowns:

input_select:
  light_temperature:
    name: Light Temperature
    options:
      - 2000
      - 2500
      - 3000
      - 3500
      - 4000
      - 5000
      - 6000
      - 6535

Script:

alias: Zigbee Light 1
sequence:
  - service: light.turn_on
    metadata: {}
    data:
      kelvin: "{{ states("input_select.light_temperature") }}"
      brightness: "{{ states("input_select.light_brightness") }}"
    target:
      entity_id: light.zigbee_1_light
mode: single

Results after I click save:

alias: Zigbee Light 1
sequence:
  - service: light.turn_on
    metadata: {}
    data:
      kelvin:
        "[object Object]": null
      brightness:
        "[object Object]": null
    target:
      entity_id: light.zigbee_1_light
mode: single

I tried various different ways to pass the values and I get errors no matter what I try. I even created sensor helpers that reference the input_select helpers so there is only a single value and that does not work either. Please help.

The quotes must be different, either:


"{{ states('input_select.light_brightness') }}"

or


'{{ states("input_select.light_brightness") }}'

Thank you for the quick response. That worked perfectly. Can I ask why the quotes need to be different so that I and others reading this in the future understand the reason. Thanks.

You can’t use double quotes in a string that is already wrapped in double quotes, you have to escape or to use the opposite quotes (= single in double and vice-versa). see Escaping.

1 Like