Template triggers should allow Jinja templates #1153
Unanswered
tetele
asked this question in
Entity Models
Replies: 1 comment
-
To me, this sounds good. We have been matching up all of the modern templates with the automation syntax. So, from my point of view, adding Need another core member to agree. 👍 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is a follow up of this comment thread.
Context
Template entities can he trigger-based, but the triggers themselves cannot contain Jinja templates. This is usually not a major limitation, but in the context of #1027, we can argue that it's fast becoming a necessity.
Automations already have this feature by using
trigger_variables
to provide some limited templates which should get parsed before the actual automation config.There will be cases when people will want to publish template blueprints in which the triggers will need to be based on input entities. This is one of the main usecases for blueprints in fact. Here's an example:
Let's say we have a blueprint such as:
Config validation would fail because the
entity_id
of state triggers is expected to be an entity ID or UUID.Proposal
Just as for automations, allow a
trigger_variables
property for template blueprints. These variables would be parsed just before registering the trigger for the template, allowing blueprint publishers to attach triggers to entities provided as input upon instantiation of their blueprints.In the config above, that would mean moving the 3 items under
variables:
totrigger_variables:
. Just as for automations,trigger_variables
should also be available when the template entity state/attributes/availability actually gets computed or in the underlying action definitions.Beta Was this translation helpful? Give feedback.
All reactions