Open panhans opened 2 days ago
Hey there @phracturedblue, @tetienne, @home-assistant/core, mind taking a look at this issue as it has been labeled with an integration (template
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
template documentation template source (message by IssueLinks)
@tetele implemented this regarding the change log.
What you're showing is expected behavior with the current implementation. I see several issues in your code:
!input
in a trigger, which won't worktrigger_variables
(as with automations), that is not yet implemented in blueprints for template triggers.{{ trigger.event.data.state }}
would workThanks for your fast respond.
A last question: Are triggers on the roadmap for this features or is it not planned for now?
trigger_variables
for template
yet. There may be soon, but not in the current implementation.trigger_variables
aren't. You can have a static trigger in your blueprint, which does not use any input
s and you're fine.Ok, this is what I've tried to filter the events by entity_id with a default ha event. But it results in the same error:
blueprint:
name: Trigger
description: ""
domain: template
input:
reference_entity:
name: Entity
description: ""
selector:
entity:
variables:
reference_entity: !input reference_entity
trigger:
- trigger: event
event_type: state_changed
binary_sensor:
availability: "{{ iif(trigger.event.data.entity_id != reference_entity, this.attributes.availability, states(reference_entity) not in ('unknown', 'unavailable')) }}"
state: "{{ iif(trigger.event.data.entity_id != reference_entity, this.attributes.state, trigger.event.data.state) }}"
Or did you mean with trigger_variables not the trigger variables section but e.g. this: trigger.event.data.entity_id
I can replicate your issue. Intriguing behavior, I'll have to look into it a bit more until I can provide an answer.
The problem
When setting up a blueprint for template entities triggers won't work and ends in a runtime error.
What version of Home Assistant Core has the issue?
2023.11.1
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
No response
Link to integration documentation on our website
https://www.home-assistant.io/integrations/template/#using-blueprints
Diagnostics information
No response
Example YAML snippet
Anything in the logs that might be useful for us?
Additional information
No response