Help needed with passing variable to script

Hi, I am trying to pass a state value (on/off) of my yeelight lamp from an automation to a script. The script first changes the color of the lamp to yellow for 1s and then, based on previously passed state value either changes the color back to a previous one and leaves the lamp turned on (if the state before running the script was “off”) or turns off the lamp (if the state was “off”).

The problem is I do not know how to test the passed variable in a condition statement.
The automation.yaml part looks like:

action:
    service: script.blink_lamp
    data:
      lamp_state: states('light.lamp_bedroom')

The scripts.yaml part looks like:

'blink_lamp':
  sequence:
    - service: light.turn_on
      data:
        entity_id: light.lamp_bedroom
        RGBTransition: [255, 215, 0, 1000, 1] 
    - condition: template
       value_template: {{ lamp_state == 'on' }}
    - service: light.turn_on
      data:
        entity_id: light.lamp_bedroom
        RGBTransition: [255, 64, 0, 1000, 1] 

I am getting the parsing error:

Error loading /config/configuration.yaml: invalid key: "OrderedDict([("stav_lampicky == 'on'", None)])"
  in "/config/scripts.yaml", line 9, column 0

Delimit the template with double-quotes and remove the extra space in front of value_template:

    - condition: template
      value_template: "{{ lamp_state == 'on' }}"

Hi, thanks, but it helped just partially - I do not get parsing error anymore. However regardless of the value (‘on’ or ‘off’) the script does not get over the condition to perform next action in the script. Any suggestion? Is there a way to debug the script to see what is the real value of lamp_state?

Change the automation’s service call to this:

action:
  service: script.blink_lamp
  data_template:
    lamp_state: "{{states('light.lamp_bedroom')}}"