Error when attempting to reference scripts folder vs scripts.yaml

I can not for the life of me figure out why I can’t get a folder of scripts to be correctly referenced in the configuration.yaml file.

According to the Splitting up the configuration documentation this should work.

configuration.yaml:

# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# configure https that was setup via DuckDNS add-on
http:
  ssl_certificate: /ssl/fullchain.pem
  ssl_key: /ssl/privkey.pem
  ip_ban_enabled: true
  login_attempts_threshold: 5

# Text to speech
tts:
  - platform: google_translate

homeassistant:
  customize: !include customize.yaml

automation: !include automations.yaml
#binary_sensor: !include binary_sensors.yaml
group: !include groups.yaml
light: !include lights.yaml
#script: !include scripts.yaml
script: !include_dir_merge_named scripts
scene: !include scenes.yaml
template: !include_dir_list template
homekit: !include homekit.yaml

Constant Error:

File Structure:

Next time, please post text, not an image of text. No one wants to retype out entire configurations.


As for your issue, you should be using !include_dir_merge_list scripts not !include_dir_merge_named scripts

Dang it! Thanks, for whatever reason I was thinking it needed to be a dictionary that was returned and not a list. Thanks and will do on the text in the future … that makes complete sense.

1 Like

So I’m diving in a little more … and while the error goes away for the configuration, I’m not seeing any reference or ability to call up the scripts that I’ve placed in the scripts folder. Below is the sample script I’m using, and I’m unable to call that script from the Developer Tools. UI doesn’t seem to see that script anywhere for inclusion in automations, developer tools, etc.

Error:

Failed to call service script.lights_off. Unable to find service script.lights_off

Script:

lights_off:
  alias: Lights OFF
  sequence:
    - delay: 0
    - service: light.turn_off
      data:
        entity_id: all

Is there a good way to check that the scripts are being properly included other that what I’m looking at?

Ok, so… maybe I had automations and scripts backwards in my head. Take a look at my configuration, it’s linked in my avatar. It has exactly what you’re looking for with broken out scripts. Just copy/paste my config section for scripts and follow the correct convention in my yaml.

I don’t believe you can use UI scripts at all. Everything has to be yaml.

Will it not show as a service in the Developer Tools > Services ?

This looks like it did it (pulled from your config). Looks like the trailing “/” might be what was needed?

script: !include_dir_merge_named scripts/

na, that’s not needed. There’s most likely an error in one of your files.

It will show as a service, it won’t be editable in the UI via the scripts editing area.