Used dir_merge_named but it never reads from the second script entry in configuration.yaml
Yeah what doesn’t? Do they appear in HA and just not in the script editor, or do they not appear in HA at all?
How have you organised your split scripts?
Only scripts that loads in HA is from the original scripts.yaml
Currently i have only one file in the config/scripts folder
scripts_harmony.yaml
in the file I have multiple scripts for harmony in the style as:
whatson:
alias: Vad är det på tv
sequence:
- service: remote.send_command
data:
device: 49114562
entity_id: remote.harmony_hub
command:
- green
- DirectionRight
- back
delay_secs: 5
script: !include scripts.yaml
script specific: !include_dir_merge_named scripts
Needs to be one script per file, and I haven’t used dir_merge_named for a while but I think you put the name of the script as the name of the file, and then start the contents of the file with alias:
and sequence:
up against the left edge.
Ignore the last bit, I’ve just been back through my GitHub commits and checked.
Did it work for you in the end? I got the same problem.
I tried the following:
script: !include scripts.yaml # UI generated scripts
script manual: !include_dir_merge_named scripts/ # Manual scripts
That does only load scripts.yaml
Another try:
#script: !include scripts.yaml # UI generated scripts
script manual: !include_dir_merge_named scripts/ # Manual scripts
That gave an error on startup so no scripts are loaded at all: Error during setup of component script
Another try:
# script: !include scripts.yaml # UI generated scripts
script: !include_dir_merge_named scripts/ # Manual scripts
That actually loaded the scripts from the scripts folder but then the ones generated from the ui are not loaded anymore!
Any help please?
remove the /.
are your scripts 1 per file?
this should work:
script: !include scripts.yaml
script extra: !include_dir_merge_list scripts
Doesn’t work. I’m pretty sure scripts need the include_dir_merge_named instead of the include_dir_merge_list. Also the / should not make any difference.
Yours one works with automation (I have exactly that for the automations) but not for scripts.
Never got it to work.
I just included the folder and skipped the single file used when creating scripts trough UI.
script: !include_dir_merge_named my_script
Guess it is a bug then. I opened an issue (see https://github.com/home-assistant/home-assistant/issues/15628). Please upvote if you’re also affected by this.
if its any help, I use script: !include_dir_merge_named scripts
in configuration.yaml, and have all scripts loaded…
several folders in the /scripts folder, and they all have more scripts in them, formatted as follows:
opstart:
alias: Opstart
sequence:
- service: script.scene_opstart
opstart_direct:
alias: Opstart direct
sequence:
service: input_select.select_option
data:
entity_id: input_select.arrive_leave
option: Opstart
so no leading -
also all scripts in packages load without issue.
Also ran into this problem. Using script: !include_dir_merge_named script
works fine obviously, but having anymore than one occurrence of script
just fails.
script extra: !include_dir_merge_named script
script: !include scripts.yaml
Reason I would like to do this is that I have a load of scripts that are already setup and in use in the directory, but it requires a restart of HA to get changes loaded. Where as when you have the default script.yaml in root, you can use the super easy reload script setting in the UI to quick check any changes you make, or setup new scripts, and when they are working all ok, you can move them to their own yaml in the directory.
This would be a very nice so we can use the editor in the ui and separate files in a sub dir.
Anyone got this to work now?
It seems to work fine for scenes but I still struggle with using both UI version and loading my old script files from script folder
Workaround by hard linking scripts.yaml
into your custom scripts
folder:
ssh username@your_hass.ip
cd config
ln scripts.yaml your-script-folder/scripts.yaml
(This makes a “hard link
”, that is, the file scripts.yaml
now appears two places: as config/scripts.yaml
that will continue to be edited by the UI script editor, and as config/your-script-folder/scripts.yaml
and thus loaded just like your other scripts.)
I can confirm that this works. It is not pretty, but it does the job
Issue opened again. 2018’s issue went stale and got closed.
I commented on Github however why don’t you use packages to accomplish this? I have a scripts package for example however I could have multiple packages containing scripts.
I will try this out
this solved it for me.
Yes, but this was not the isue.
We would like to have both manual scripts in a folder structure AND the script.yaml which is needed in the root of config to be able to use the UI editor.
To get multiple script files form a folder is no issue as you can see earlier in the thread. It is coexistence with UI edito.