Scripts separated out into individual files

I’m looking at re-organising scripts for my setup and having used the !include_dir_merge_list for automations, I thought it would also work for scripts. I have;

script: !include_dir_merge_list scripts/

in my configuration.yaml. Where /config/scripts is the directory i have split the original scripts.yaml file. I don’t get any error message from the ‘check config’ facility, but it no scripts are available from the Configuration->Script menu.

Any guidance gratefully received.

Needs to be !include_dir_merge_named

1 Like

Thanks, that works. Not sure why it works and the other route doesn’t. Much appreciated.

No prob! It’s because automations are a list, and scripts are a dictionary. Note that you have a hyphen at the beginning of each automation, but you don’t at the beginning of each script. Look at the difference between dir_merge_list and dir_merge_named in these examples.

1 Like

Thanks. I had tried using the hyphen in the script definitions but that gave errors, your explanation makes that clear as to why it wouldn’t work, all working now.

I was going to say that it’s just yaml spacing and you can get the two to follow the same format cos that’s what I do in my packages (input_boolean, input_number, customisation, automation and scripts etc. All in the same file.
But before mouthing off, I thought I’d check and though I can copy actions and conditions directly between the two - one is a list and the other a dictionary :flushed:
I’m sure you can get them all as one or the other (would certainly help support) but once you get stuff working, it’s a major PITA (as Taras says) to convert, and it works just the same.
Go with what works :+1: