#Script fields documentation and action field usage

1 messages · Page 1 of 1 (latest)

sacred moss
#

I couldn't find the documentation about the parameters of the script fields.

And also, how do I run the actions described in one of the fields?

heavy obsidian
#

fields aren't actions - they are just a nice way to handle parameters

sacred moss
#

I know, but one of those parameter types is "actions"

bronze robin
#

You mean a(n action) selector?

Should be able to call it like:

sequence: !input field_name
sacred moss
#

Error in parsing YAML: unknown tag !<!input> (line: 15, column: 22)

#

I tried as
⁨```
sequence: {{test}}

as well and same result
gray pastureBOT
#

To format your text as code, enter three backticks on the first line, press Enter for a new line, paste your code, press Enter again for another new line, and lastly three more backticks.
```yaml
example: here
```
Don't forget you can edit your post rather than repeatedly posting the same thing.

sacred moss
#

sorry for formating

dense talon
#

It’s an action, so it would go under the action key. It doesn’t replace the entire sequence in the automation.

sequence:
  - action: "{{ test }}"
sudden bobcat
#

!input is for blueprints, not scripts.

sudden bobcat
#

Actually I'm not sure the action selector is usable for scripts at all

dense talon
#

I tested it out, it worked fine 🤷‍♂️

sacred moss
#

I did myself and didn't

#

In a script, not a blueprint

sudden bobcat
#
sequence:
  - action: "{{ test }}"

This is what you used? How can that work?

Test is an array, of action objects

#

That would be like:

sequence:
  - action: 
     - action: light.turn_on
       data: ...

Which doesn't seem valid...

dense talon
#

No, you’re right. On my phone now but I still have the script saved. It is accepted and the fields work correctly, but you are correct it errors when ran

#

🤦‍♂️

sudden bobcat
#

This kinda works:

fields:
  action:
    selector:
      action: {}
    name: action
sequence:
  - repeat:
      for_each: "{{ action }}"
      sequence:
        - action: "{{ repeat.item.action }}"
          target: "{{ repeat.item.target}}"
          data: "{{ repeat.item.data }}"