Can I make my script variables visible the visual editor?

Is there a way to declare variables in a script so that the fields show up in the visual editor? Say I’ve got a script that expects a variable called “message”. Can I expose that variable so that the visual builder knows that and gives me a prompt to enter the value for “message”?

That’s a simple example, but I’ve got a few scripts that accept multiple variables and I occasionally have to open the script to remember the names used for vars.

I tried adding a “variables:” key to the sequence, but that doesn’t appear to affect the visual builder.

When I look at my scripts in the developer tools > service calls screen, it does list the fields that I have defined.

fields:
  light_target:
    description: The light to target
    example: light.livingroom_window
  brightness_target:
    description: The target brightness % to change to
    example: 50%

But no they don’t show up in the visual script / automation editor.

Thanks. That’s helpful - I don’t see anything about fields in the script docs. I’ll start doing this in hopes that it’s something that the visual editor will someday support.

It’s listed in this section: Scripts - Home Assistant

Ah. I was here: Script Syntax - Home Assistant

1 Like