#Script fields documentation and action field usage
1 messages · Page 1 of 1 (latest)
fields aren't actions - they are just a nice way to handle parameters
I know, but one of those parameter types is "actions"
You mean a(n action) selector?
Should be able to call it like:
sequence: !input field_name
Doesn't seem to work
```
fields:
test:
selector:
action: {}
name: test
default:
- action: light.turn_on
metadata: {}
target:
entity_id: light.ceiling_light
data:
brightness_pct: 100
alias: New script test
description: ""
sequence: !input test
Error in parsing YAML: unknown tag !<!input> (line: 15, column: 22)
I tried as
```
sequence: {{test}}
as well and same result
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.
sorry for formating
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 }}"
!input is for blueprints, not scripts.
Actually I'm not sure the action selector is usable for scripts at all
I tested it out, it worked fine 🤷♂️
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...
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
🤦♂️
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 }}"