Editing scripts in UI with legacy scripts

I have been using HA a long time so all of my scripts were created by hand. I have a bunch of files in a scripts directory and my configuration.yaml has this…

####################################
# Scripts
####################################
script: !include_dir_merge_named scripts

I created a new script with the fancy new UI and after I saved it I couldn’t find it. After some looking I found the new script in a scripts.yaml file in my config directory but my configuration does not read that file.

How can I use both sources? My scripts folder AND the scripts.yaml file the UI creates.

I don’t think you can !
If you want to use the UI editor and the single scripts.yaml file you would need to remove the !include line in your configuration

That is a good question. It can be accomplished with Automations, however I cannot get this same trick to work with scripts.

automation yaml: !include_dir_merge_named automations
automation: !include automations.yaml

It should work fine with script

1 Like

Oh, you are correct sir! Thank you for pushing me to try it again.

@oliwa this works for me. You have to restart for it to take effect.

script yaml: !include_dir_marge_named scripts
script: !include scripts.yaml

I did that and when I reload the scripts all of my old scripts are gone and just the ones in the script.yaml are in the scripts list.

####################################
# Scripts
####################################
script yaml: !include_dir_merge_named scripts
script: !include scripts.yaml

Your old scripts will only show up in the devtool states page. Also, if you’re dead set on using the UI, just copy/paste the scripts into your scripts.yaml. Then you can edit your old ones and new ones.

All of the scripts in my Lovelace UI are not found now so I can’t run any of them.

but when you restart they do show up? Could be a reload issue.

also, lovelace does not equal dev tools states page

Restarting did not change the behavior.

Yes, I know what the Dev Tools States page is. Having to go there to run a script where before I could click the script from Lovelace is not a viable option for me.

I reverted back to using script: !include_dir_merge_named

It’s not intended, I wanted you to check to verify that they still existed in the system. Responding with “lovelace doesn’t show them” tells me you didn’t read my sentence and decided to blurt something else out.

I reloaded, only one script in the dev tools.

I restarted, only one script in dev tools.

With this…

####################################
# Scripts
####################################
script yaml: !include_dir_merge_named scripts
script: !include scripts.yaml

The scripts are only loaded from the scripts.yaml file. Nothing is loaded from the directory.

I just came here to tell you trying this made all of my yaml scripts disappear. That’s why I didn’t have that enabled. Haha.

Hi,
i can confirm, it’s also not working in my case.