Trying To Clean Up Scripts - How Do I Find Which Automations They Are In?

I’m trying to clean up my Home Assistant setup and remove scripts I’m not using and consolidate duplicate/redundant scripts. Is there a way to see what automations are calling a script, I don’t want to delete a script and break any automations.

thanks in advance.

I know nothing else but to scan through automations.yaml

We would need to know more about your setup. If you run on Linux and use YAML config files, you can use the grep utility.

I use watchman for this and much more:

In your case you could rename the script before deleting it and check with watchman.

I am running on Linux using YAML files, but my Linux understanding is virtually non-existent, and don’t really know what the grep utility is.

It’s one of the most used utilities on Linux (at least for me). Learning it will be well worth your time! You can do similar things with some editors though, if you prefer.

For now, start with this, in you config directory:

grep -ir "script.your_script"

Replace your_script as desired with the correct name.

I gave Watchman a try, this was my result

-== Missing 172 entity(ies) from 655 found in your config:

Looks like that will give me what I’m looking for, thanks, looks like I have 172 problems that need fixing.

1 Like