Using scripts with light template

I think I’m a bit confused here and could use some help. I am trying to create a script that runs custom light effects depending on an input_select via a light template.

this is my light template:

- platform: template
  lights:
    living_room_light_template:
      friendly_name: "Living Room Light Template"
      level_template: "{{ state_attr('light.living_room_lights','brightness') }}"
      value_template: "{% if states('switch.living_room_ceiling_light_relay') == 'off' %} {{'off'}} {%else%} {{ states('light.living_room_lights') }} {%endif%}"
      temperature_template: "{{state_attr('light.living_room_lights','color_temp_kelvin') | int}}"
      hs_template: "{{ state_attr('light.living_room_lights','hs_color') }}"
      effect_list_template: "{{ state_attr('input_select.living_room_light_effects', 'options') | list}}"
      effect_template: "{{ states('input_select.living_room_light_effects')}}"
      turn_on:
        action: script.living_room_lights_on
      turn_off:
        action: script.living_room_lights_off
      set_level:
        action: light.turn_on
        target:
          label_id: living_room_lights
        data:
          brightness: "{{ brightness }}"
      set_temperature:
        action: light.turn_on
        target:
          label_id: living_room_lights
        data:
          color_temp: "{{ color_temp }}"
      set_hs:
        action: light.turn_on
        data:
          entity_id: "{{ label_entities('Living Room Lights') | list }}"
          #transition: "{{ transition | float }}"
          hs_color:
            - "{{ hs[0] }}"
            - "{{ hs[1] }}"
      set_effect:
        - action: script.living_room_lights_effect
          data:
            effect: "{{ effect }}"
      set_rgb:
        action: light.turn_on
        data:
          entity_id: "{{ label_entities('Living Room Lights') | list }}"
          #transition: "{{ transition | float }}"
          rgb_color: ({{ r }} , {{ g }} , {{ b }})
########### not available on Wiz Matter Bulbs Currently
#      set_rgbww:
#        action: light.turn_on
#        data:
#          entity_id: "{{ label_entities('Living Room Lights') | list }}"
#          #transition: "{{ transition | float }}"
#          rgbww_color: ({{ r }} , {{ g }} , {{ b }}, {{ cw }}, {{ ww }})
#      supports_transition_template: "{{ true }}"


And this is my script:

sequence:
  - choose:
      - conditions:
          - condition: template
            value_template: "{{effect == 'Warm White'}}"
        sequence:
          - action: light.turn_on
            target:
              label_id: living_room_lights
            data:
              kelvin: 2650
      - conditions:
          - condition: template
            value_template: "{{effect == 'Cool White'}}"
        sequence:
          - action: light.turn_on
            target:
              label_id: living_room_lights
            data:
              kelvin: 5400
alias: Living Room Lights Effect
description: ""

I’m getting an error:

2025-02-25 13:23:52.605 ERROR (MainThread) [homeassistant.helpers.script.living_room_light_template] Living Room Light Template: Error executing script. Service not found for call_service at pos 1: Action script.living_room_lights_effect not found

A pop up says: “action script.living_room_lights_effect uses action light.turn_on which was not found.”

I also think I’m not passing the effect variable properly and could use some guidance on that.

Thanks in advance

Error message seems pretty clear to me, no script with entity id script.living_room_lights_effect exists. Double check what entity id the script actually has, as I am pretty sure it will not automatically update if/when you changed the name/alias of the script.

This was the problem. I originally fat fingered the name and corrected it in the UI:

I did not realize that the name did not actually change in the yaml file:

living_room_light_efffects:
  sequence:

However, now when I correct the name in the scripts.yaml, the entity ID in the UI says:
image
and it throws an error saying the ID is already in use if i change it to match.

Is there a way to fix this?

Thanks for your help so far.

Go to Settings > Devices & services > Entities and find the script.living_room_lights_effect entity (it will probably have a red exclamation icon in the rightmost column) and delete it. Then rename the “new” entity.

Appreciate it, thanks.