List all automations that are triggered by a specific entiy

Is there a way to list all automations that have a specific entity as a trigger?

If yes, can this be expanded to:

  • all automations with a specific entity as condition
  • all automations with a specific entity as action

Searching in vscode returns just everiting for a specific entiry (or any search string). So this returns way to much results.

The VS Code search, to me, is the easiest way and just look at the automations.yaml, it will create a new line for each instance found. Other than that and looking at the related list of a given entity I don’t really think there are too many more options.

In VSCode you can search for multiple line matches. e.g. select:

- platform: state
  entity_id: sensor.foobar

And copy it all into the search box.

It also supports regex search which is quite powerful.

or

  - platform: state
    entity_id: sensor.foobar

The indentation is not the same in all my yaml’s. Sometime ‘- platform’ has 2 spaces in front of it, in other cases 4. If the automation is in a yaml under packages, or under automations, there is a difference.

Would love to learn how to do this with a regex expression. A domain that I don’t fully understand (I more or less understand what happens when I read the regex, but writing one myself ? nope :slight_smile: )

And when I would like to do a simple search for an entity in a codition, it gets even worse when conditions are nested. I get even more spaces in front of ‘- platform’…