Where can I expand templates?

Hi all,

I’m still trying to understand where I’m allowed to expand templates to save typing.
E.g., I have a blueprint where I hand in a group to save some typing and use filters to get the data.
I want to trigger on changes to the underlying entities in the (old style) group, which groups a couple of number sensors.
I’ve tried various attempts to put put a template into the entity_id: of a state trigger, but it seems like templates are not expanded there? Are there any write-ups on where exactly I can template / what I can template? I’d like to use template loops / filters in multiple places to save typing, but it seems I can’t just throw them in at arbitrary places to create the config. What am I missing?

Thanks!

Correct, you can’t use templates anywhere, but only where it’s explicitly mentioned in the documention.

For example:

Here’s the documentation for State Trigger.

It doesn’t explicitly mention that entity_id supports a template and doesn’t provide any examples where entity_id contains a template. In general, the documentation limits itself to presenting only what is possible.

Thanks for the answers, that’s helpful.

Are people using other mechanism to avoid endless repetition? I could write some python to generate the yaml, but that sounds like I’d be basically introducing another programming layer above home assistant. I know about the various python integrations, but is there something that’s more along the lines of “make writing yaml less repetitive”?

YAML Anchors and Aliases

Examples

1 Like