I am receiving an error message when I try to save a script, which will be used in a larger automation

Hi everyone!

I am extremely new to Home Assistant and I am setting up a new automation. The automation will be triggered if my college football team wins their game. When the automation is triggered, a script is called, which does the following:

  1. Creates a new scene of the current state of the lights.
  2. Changes the lights to specific colors and effects.
  3. Delays for 1 minute.
  4. Switches the lights back to their original states by calling the newly created scene.

I followed the tutorial outlined here, adapting the script to my own lights. Here is my script:

alias: Dawgs_Celebrate
description: Plays a specific preset on Govee and Phillips Hue LED lightstrips.

# 1. Save current settings as a new scene
sequence:
  - service: scene.create
    data_template:
      scene_id: led_strip_states
      entities:
        light.govee_h805a:
          state: "{{ states('light.govee_h805a') }}"
          min_color_temp_kelvin: "{{ states('light.govee_h805a.attributes.min_color_temp_kelvin') }}"
          max_color_temp_kelvin: "{{ states('light.govee_h805a.attributes.max_color_temp_kelvin') }}"
          min_mireds: "{{ states('light.govee_h805a.attributes.min_mireds') }}"
          max_mireds: "{{ states('light.govee_h805a.attributes.max_mireds') }}"
          effect_list: "{{ states('light.govee_h805a.attributes.effect_list') }}"
          supported_color_modes: "{{ states('light.govee_h805a.attributes.supported_color_modes') }}"
          effect: "{{ states('light.govee_h805a.attributes.effect') }}"
          color_mode: "{{ states('light.govee_h805a.attributes.color_mode') }}"
          brightness: "{{ states('light.govee_h805a.attributes.brightness') }}"
          color_temp_kelvin: "{{ states('light.govee_h805a.attributes.color_temp_kelvin') }}"
          color_temp: "{{ states('light.govee_h805a.attributes.color_temp') }}"
          hs_color: "{{ states('light.govee_h805a.attributes.hs_color') }}"
          rgb_color: "{{ states('light.govee_h805a.attributes.rgb_color') }}"
          xy_color: "{{ states('light.govee_h805a.attributes.xy_color') }}"
        light.stair_display_case:
          state: "{{ states('light.stair_display_case') }}"
          min_color_temp_kelvin: "{{ states('light.stair_display_case.attributes.min_color_temp_kelvin') }}"
          max_color_temp_kelvin: "{{ states('light.stair_display_case.attributes.max_color_temp_kelvin') }}"
          min_mireds: "{{ states('light.stair_display_case.attributes.min_mireds') }}"
          max_mireds: "{{ states('light.stair_display_case.attributes.max_mireds') }}"
          supported_color_modes: "{{ states('light.stair_display_case.attributes.supported_color_modes') }}"
          color_mode: "{{ states('light.stair_display_case.attributes.color_mode') }}"
          brightness: "{{ states('light.stair_display_case.attributes.brightness) }}"
          color_temp_kelvin: "{{ states('light.stair_display_case.attributes.color_temp_kelvin') }}"
          color_temp: "{{ states('light.stair_display_case.attributes.color_temp') }}"
          hs_color: "{{ states('light.stair_display_case.attributes.hs_color') }}"
          rgb_color: "{{ states('light.stair_display_case.attributes.rgb_color') }}"
          xy_color: "{{ states('light.stair_display_case.attributes.xy_color') }}"
          mode: "{{ states('light.stair_display_case.attributes.mode') }}"
          dynamics: "{{ states('light.stair_display_case.attributes.dynamics') }}"
        light.living_room_shelf:
          state: "{{ states('light.living_room_shelf') }}"
          min_color_temp_kelvin: "{{ states('light.living_room_shelf.attributes.min_color_temp_kelvin') }}"
          max_color_temp_kelvin: "{{ states('light.living_room_shelf.attributes.max_color_temp_kelvin') }}"
          min_mireds: "{{ states('light.living_room_shelf.attributes.min_mireds') }}"
          max_mireds: "{{ states('light.living_room_shelf.attributes.max_mireds') }}"
          effect_list: "{{ states('light.living_room_shelf.attributes.effect_list') }}"
          supported_color_modes: "{{ states('light.living_room_shelf.attributes.supported_color_modes') }}"
          effect: "{{ states('light.living_room_shelf.attributes.effect') }}"
          color_mode: "{{ states('light.living_room_shelf.attributes.color_mode') }}"
          brightness: "{{ states('light.living_room_shelf.attributes.brightness) }}"
          color_temp_kelvin: "{{ states('light.living_room_shelf.attributes.color_temp_kelvin') }}"
          color_temp: "{{ states('light.living_room_shelf.attributes.color_temp') }}"
          hs_color: "{{ states('light.living_room_shelf.attributes.hs_color') }}"
          rgb_color: "{{ states('light.living_room_shelf.attributes.rgb_color') }}"
          xy_color: "{{ states('light.living_room_shelf.attributes.xy_color') }}"
          mode: "{{ states('light.living_room_shelf.attributes.mode') }}"
          dynamics: "{{ states('light.living_room_shelf.attributes.dynamics') }}"

  # 2. Change lights to celebration
  - service: light.turn_on
    data:
      effect: GoDawgs1
      brightness: 70
    target:
      entity_id: light.govee_h805a
  - service: light.turn_on
    data:
      effect:
      brightness: 70
      rgb_color: [255, 0, 0]
    target:
      entity_id: light.stair_display_case
  - service: light.turn_on
    data:
      effect: sparkle
      brightness: 70
      rgb_color: [255, 0, 0]
    target:
      entity_id: light.living_room_shelf

  # 3. Delay for 1 minute
  - delay:
      hours: 0
      minutes: 1
      seconds: 0
      milliseconds: 0

  # 4. Switch lights back to their original states
  - service: scene.turn_on
    entity_id: scene.led_strip_states

When I try to save the script, I receive the following error message: Message malformed: template value should be a string for dictionary value @ data[‘sequence’][0][‘data_template’]

I am running Home assistant on a Raspberry Pi 4 B+ with the following information:

  • Installation method: Home Assistant OS
  • Core: 2025.10.02
  • Supervisor: 2025.10.0
  • Operating System: 16.2
  • Frontend: 20251001.2

If you have any suggestions what is wrong with my script, I would greatly appreciate your help!

That tutorial is 5 years old… which is old in HA time.

The configuration key data_template was soft-deprecated at least 4 years ago… and I don’t think templates are supported in the scene.create action.

If you want to capture the current state of an entity with scene.create use the snapshot_entities configuration key instead of entities:

...
  - action: scene.create
    data:
      scene_id: led_strip_states
      snapshot_entities:
        - light.govee_h805a
        - light.stair_display_case
        - light.living_room_shelf
....

Thanks so much for this information! This was so helpful.