When I test the template in the template-editor it shows me the right channel number.
When I test the service whit a number instead of the template it works also.
The log shows the following error:
"ValueError: invalid literal for int() with base 10: '"{{ state_attr(\'media_player.kodi\', \'media_content_id\') + 1 | int }}"\n'"
I tried alos with data_template and service_template, but always the same error.
What do I have to chance to use the template in a action??
Thanks
@123 Taras
I use the frontend editor to write the automation, and when I save and reopen it, the â>â is replaced by â|â. So I believe its the same.
@pnbruckner
It is a number, so I guess it is an integer.
Ah, ok, I see it now. @micque is correct. You need to remove the outside quotes.
EDIT: BTW, in the future, please post the entire automation, not just a snippet. Without the whole thing weâre forced to guess the context, and the part you didnât post might be the problem, or at least might make it easier to interpret the little you did post.
If the template is NOT on the same line as the option then > is used and the template is NOT delimited with quotes.
If the template IS on the same line as the option then > is NOT needed and the template MUST be delimited with quotes.
Random thoughts:
The Automation Editor, for all its good intentions, often leads to user-support issues. It canât produce all the code that Home Assistant is capable of understanding and what code it does produce often doesnât look anything like what is shown in examples:
alphabetically sorted options (good for robots, not humans)
doubled single-quotes (because, no idea)
vertical bar to indicate line continuation (thatâs a new one for me)
⌠thatâs not shown in any examples found in the documentation nor in the majority of whatâs shared in the forum. The Automation Editor ought to speak street-YAML (not the ''dialect'' it uses).
As many have said, the frontend editor is not fully featured yet. And this seems to be one of the main limitations â i.e., you canât use data_template in the editor.
In a service call, templates will not be rendered if you donât use data_template. So, you have two choices, at least for now: use the frontend editor but not templates, or hand edit YAML files so that you can use templates.
For future reference, itâs the custom of this community forum to tag the post containing the answer to your question as the âSolutionâ. In other words, whichever post helped to solve the original problem is the solution. The original problem was to fix a template containing syntax errors.