New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add jinja2 editor to template triggers/conditions #12365
Conversation
src/components/ha-code-editor.ts
Outdated
@property() public name; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is :)
Trigger event changed assume FormElement
(from mwc-base
, which our code editor isn't).
This we need to supply the bare minimum we depend upon, which is the name (used by the handleChangeEvent
in the ha-automation-trigger-row.ts
file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can have the name on the element in ha-automation-trigger-row.ts
without needing to add the property in the element. It will still set the name attribute and should be gettable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, so I'm a noob at frontend stuff and you would need to help / provide a hint me on this one.
It tried setting the name on HTML, but apparently: that is not enough to access it as a property. So, I guess I'm missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use can use .name=${"name"}
This will set it as a property. You are correct that it needs the Attr when setting it with just name=""
Proposed change
Add the code editor with Jinja2 syntax to the template trigger and template condition.
Type of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: