Error on light template into configuration.yml

I am new to HA and a question about the light entity.

On several websites i see HA tutorials using the light entity for testing automation.
This light entity is missing on default installation.

So i copied the Light-template

into my configuration.yaml file
After restarting i get an error, and i have no clue what is wrong.

The system cannot restart because the configuration is not valid: Invalid config for [light.template]: some but not all values in the same group of inclusion ‘effect’ @ data[‘lights’][‘theater_lights’][]. Got None. (See ?, line ?).

It’s a simple copy paste action, and The yaml ident looks allright to me

My configuration is 2021-7.3 on VirtualBox
Does anyone also had these issues?
What do i wrong?

Regards,

Jan de Vries

1 Like

That yaml is not cut and paste unless you have the entities supplied in the light template. There looks like 7 required entities.

Thanks but

When i remove line
effect_list_template: “{{ state_attr(‘light.led_strip’, ‘effect_list’) }}”
and the last 7 lines of that file, i have no errors anymore
And i see a entity called “Theater Lights” in the ui.
And the restart is succesfull.

Also other template like “lock” and “fan” can be copied pasted, from here

Regards,

Jan,

That field still needs a list to work from and if you don’t have light.led_strip it’s not going to work. Let alone the rest will not work if you don’t have the other entities. It just so happens that this template field requires a list and you’re returning nothing.

If you want it to work, you have to have the entities.

Also, the way you’re going about this is flawed. You’ll never learn the system if you just copy/paste things without adjusting it to your features.

I suggest you explain what you want to do, and then we can help you get there.

Ok Petro thanks.

I want to learn HA, just fom the basics. So i watched several video’s.
Like this one and some others.

But they all use entities which i do not have from a basic installation.
Some of them work with the “light” entity.

My goal is, to just make a script working, that for example turns some entity on and off.
Just learning the basics.

Regards,

Jan

use the demo integration

it will create all feature types to play with. Delete all the templates you created.

Thank you, i will take a look at this.

@petro, I have the same issue as @jdvries20 - the example Template Light - Home Assistant (home-assistant.io) seems to have a flaw - it only has effect_list_template, but both effect_list and effect_list_template are required to make it working. So how to fix the documentation and example?

You mean efffect_template, I guess.
Below each page of the documentation, the is an “Edit” link, which allows you to create a suggestion for change.

1 Like

It’s covered in the docs, just not in the first example. If you suggest an edit, make sure the yaml and jinja is correct.

Yeah, but the “effect” settings are vol.inclusive, so all 3 of them are required (or none).
So the 1st example is not valid…

Right, thats why I said:

Can the effect list be retrieved from an input_select?

I created one like this

then added to the light template

  - platform: template
    lights:
      ambivision:
        effect_list_template: '{{state_attr("input_select.ambivision_modes", "options")|list}}'
      turn_on:
        service: script.turn_on
      turn_off:
        service: script.turn_off

but I’m still getting the same error

Invalid config for [light.template]: [effect_list_template] is an invalid option for [light.template]. Check: light.template->lights->ambivision->effect_list_template. (See ?, line ?).

Hi guys, does anybody know why this light template is still yielding an error with the effects list?

light:
  - platform: template
    lights:
      ambivision:
        effect_list_template: "{{state_attr('input_select.ambivision_modes', 'options')|list}}"
        effect_template: "{{states('input_select.ambivision_modes')}}"
        turn_on:
          service: script.canal_cero
        turn_off:
          service: script.canal_viajar
        set_effect:
          service: input_select.set_option
          data:
            entity_id: input_select.ambivision_modes
            option: "{{option}}"

ERROR

Invalid config for [light.template]: [effect_list_template] is an invalid option for [light.template]. Check: light.template->lights->ambivision->effect_list_template. (See ?, line ?).

@new-kirte did you get it working?

Number of issues:

  1. You don’t have a value_template for the on/off state. This is not needed, however it could cause problems if you’re expecting other aspects of the light to work.
  2. option is not a valid variable in set_effect, use effect.

Other than that, it should be working. That error should not appear. My only guess is that it’s an old error based on something you did wrong previously. Check your config after making change #2 (that’s the only required change to make it work). Then check the timestamp on the error and verify that it’s appearing when you do your check config.

Thanks a lot Petro. It still is yielding the same error. I hope I made the right changes. And yep, it yields the error at the very monent I try to restart HA.

Invalid config for [light.template]: [effect_list_template] is an invalid option for [light.template]. Check: light.template->lights->ambivision->effect_list_template. (See ?, line ?).

  - platform: template
    lights:
      ambivision:
        value_template: "{{states('input_boolean.ambivision_switch')}}"
        effect_list_template: "{{state_attr('input_select.ambivision_modes', 'options')|list}}"
        effect_template: "{{states('input_select.ambivision_modes')}}"
        turn_on:
          service: script.canal_cero
        turn_off:
          service: script.canal_viajar
        set_effect:
          service: input_select.set_option
          data:
            entity_id: input_select.ambivision_modes
            option: "{{effect}}"
1 Like

yes, I did. I created an inpute_select input_select.dining_area_ceiling_light_effects with 4 values - Neutral, Cold, Warm, Night and defined the light template group:
light:

- platform: template
    lights:
      dining_area_light:
        unique_id: template_dining_area_light
        friendly_name: "Dining Area Light"
        value_template: "{{ is_state('switch.dining_area_light_relay', 'on') }}"
        effect_list_template: "{{['Neutral','Cold','Warm','Night']}}"
        effect_template: "{{ states('input_select.dining_area_ceiling_light_effects') }}"
        turn_on:
          service: switch.turn_on
          target:
            entity_id: switch.dining_area_light_relay
        turn_off:
          service: switch.turn_off
          target:
            entity_id: switch.dining_area_light_relay
        set_effect:
          - service: script.living_room_light_change_mode_v15
            data_template:
              effect: '{{effect}}'
              entity_id: switch.dining_area_light_relay
              effect_entity_id: input_select.dining_area_ceiling_light_effects

The only thing I can think of is a syntax error on startup. So change this

To this

        effect_list_template: "{{ state_attr('input_select.ambivision_modes', 'options') }}"

because options is already a list, no need to cast it. If it casts ‘None’ on startup, you might get issues.

Thanks, I used {{ state_attr('input_select.dining_area_ceiling_light_effects', 'options') }} instead of constant "{{['Neutral','Cold','Warm','Night']}}". Everything works.

I tried removing the |list filter, same result. I also tried copying, pasting and modifying @new-kirte 's example and still yields the same error. It doesn’t even allow me to restart.

I’m on 2021.5.0. When was this effect list template implemented?

By using new-kirte’s example I also get a bad indentation error in the second line.