Passing variables from blueprint to script

How can i pass a variable to a script from blueprint?

This is mye action from blueprint:

        sequence:
          - service: script.turn_on
            target:
              entity_id: !input script
            data:
              action: Auto

This is what I see in log:

service: script.turn_on
target:
  entity_id:
    - service: script.201_gangnede_lys
      data: {}
data:
  action: Auto```

I do this a lot. Read thru this blueprint helper file and you will see several examples where I explain how to add accessories to this BP.

do you mean like this?

        sequence:
          - service: !input script
            data:
              action: Auto

This is giving me the same error

no

Your are referring to a code that has a script that is given. I need that script to be an input. This is the problem, it seems that when I use an input for the script it adds a second data.

I have always done this in an action selector with the data being in templates but the name of the script known.

You cannot put !inputs in as part of !input fields. HA has no idea how to map the substitutions at that point and syntax fails.

You could do something like this:

Thanks for help, but I can’t get this to work:P

          - service: script.turn_on
            data_template:
              action: "auto"
            target:
              entity_id: !input script
          - service: script.turn_on
            data:
              action: "auto"
            target:
              entity_id: !input script

These service calls dont trigger det script right, and I can’t see why?

This is the output:

image

Is there any other way to make this work?