Newbie question about scripts

I created a script with the UI. Once it was working I editted scripts.yaml directly to add another two scripts based on the first one. But the manually editted ones didn’t appear on the dashboard.

So I created another script using the UI. That one appears too, but my others don’t. I can’t see any difference in syntax etc between the ones that appear and the ones that don’t. I’m sure I’m missing something obvious.

This is my entire scripts.yaml:

my_test_script:
  alias: My Test Script
  sequence:
    - service: rest_command.close_blind_01
      data:
        blind_id: "01"
  mode: single
close_blind:
  alias: Close blind
  sequence:
    - service: rest_command.close_blind
    - data:
        blind_id: "02"
  mode: single
open_blind:
  alias: Open blind
  sequence:
    - service: rest_command.open_blind
    - data:
        blind_id: "02"
  mode: single
my_new_script:
  alias: My New Script
  sequence:
    - service: rest_command.open_blind_01
      data:
        blind_id: "01"
  mode: single

my_test_script and my_new_script appear on the dashboard, but the others don’t. Neither are they available as an option in the ‘Scripts’ section when I create a new dashboard.

What am I missing, and/or how do I debug this?

both the ones you copied that don’t show up have a hyphen in front of data

1 Like

OMG you’re right! Removing them fixed it. Thank you so much!

I don’t know how they got in there - I’m sure I just copied & pasted.

Out of interest, do you know whether that error would have shown up in a log anywhere?

1 Like

Check Configuration > Logs.

I couldn’t find anything obvious, but perhaps I’m looking in the wrong log. I’ll take another look later.
Thanks!

When you manually add, or modify, a script in the scripts.yaml file, the changes are not visible to Home Assistant until you execute:

Configuration > Server Controls > Reload Scripts

(Or restart Home Assistant)

However, before doing that, it’s recommended to execute:

Configuration > Server Controls > Check Configuration

If your changes had any significant syntax errors, this step will report them (and log them). If there are no errors to correct, you can proceed to execute Reload Scripts (the same advice applies to manually creating/modifying automations, Template sensors, etc).

1 Like

Works perfectly. Saves rebooting the whole box too. Thanks very much!