WLED select the color pallete script error

I’m trying to use the typical script in automation for random changing the effects and palletes. Every execution I got the same error:

WLED kitchen - change the effect: Error executing script. Error for call_service at pos 2: Error rendering data template: TypeError: object of type 'NoneType' has no len()

It seems that the error occurs because of wrong type in data option in wled_color_palette random choosing script:
In Dev.tools->Templates if I change the script option: "{{ state_attr('select.wled_palette', 'options') | random }}" with something definite like option: "Blue" the error disappears. What can be wrong with the random script?

  - service: light.turn_on
    target:
      entity_id: light.wled_kitchen2
    data:
      effect: "{{ state_attr('light.wled_kitchen2', 'effect_list') | random }}"
  - service: select.select_option
    target:
      entity_id: select.wled_color_palette
    data:
      option: "{{ state_attr('select.wled_palette', 'options') | random }}"
1 Like

The entity id looks incorrect. Try:

  - service: select.select_option
    target:
      entity_id: select.wled_kitchen2_color_palette
    data:
      option: "{{ state_attr('select.wled_kitchen2_color_palette', 'options') | random }}"

Thank you for the quick and prompt reply. Now it’s working.

1 Like