although I am not familiar with the mushroom-template-card, I suspect your issue has to do with the quoting, which looks painful to my eyesâŚ
youâd help yourself a lot if youâd use multiline notation, and be done with all of these double single quotes.
As you state the primary works ( it uses 'index' ) , so single single quotes, youâd probably need to use that in the secondary too (now using double single quotes ''index'' )
if index is in fact a variable name. If it is an attribute, the question dibbler raises, youâd need to single quote them. that would be surprising though, given: Input Text - Home Assistant, and would have to been set via customize or some other option. Unless that would be some hidden option in either of the cards/integrationsâŚ
that would be the outcome if you pasted the template in dev tools template, and replace entity with an actual entity_id?
besides all of that, could it be the rest_command expects an entity_id, instead of an attribute only? this would make your challenge probably be rather Off topic for auto-entities.
DevTools - Templates â
This delivers the correct result:
{{ state_attr(âinput_text.xenia_script_17â, âindexâ) }} â 17
This provides âUndefinedError: âinput_textâ is undefinedâ:
{{ state_attr(input_text.xenia_script_17, âindexâ) }}
BUT quoting entity in primary: leads to an error.
so this gets weirder per post⌠how is your entity created? Is this some custom integration, given the presence of an attribute index, and the absence of all core attributes �
I have a python script. that creates those text_inputs (input_text.xenia_script_*) of data retrieved from an external device using hass.services.call and hass.states.set functions. Index is just a value, we could name it totally different.
I see, that would explain the out of the ordinary attribute indeed. Using the hass.states.set myself in python, and though powerful, it is prone to unexpected outcome.
Iâd suggest you take this in to a separate topic, and out of auto-entities, because it would be an issue of getting the correct attribute inside that payload template, and not so much the auto-entities part of it here. Itâs getting awfully off-topic because of that.
please check the brackets remark I added earlier, and see if thats relevant?
My understanding is, that the bracket is only used when using the Developer Tools.
Thanks so far for your support.
Regarding auto-entities and what I need to achieve:
My device provides me with a list with an unknown quantity of data pairs: Text + ID
The âTextâ part of each of these data pairs should be a button on my front.end.
Pressing the button, a rest_command (an URL) should be called that ends with the provided ID for the button (http://<fixed.URL>/execute_script?ID=ID of data pair)
I started my implementation with generating the input_text entities to achieve this.
well, its a bit of a guess on my behalf, but it could be a few things.
if the command expects a number, you should provide it. Currently youâre providing a string. try adding |float at that template?
could also be you are providing the full data pair, while you only need to provide the number?
I cant say, because can not test locally.
and about the brackets: this is a misconception, I use them in all of by payloads. the ones with only 1 data pair, and also the ones with more than that.
I have been using your code for some time now and everything is working fine. Today I miserably tried to apply an enhancement. I want to display an icon based on the entity id. If it is a light, display a lightbulb, if it is a fan, display a fan. What am I missing? This is my code:
hmm. I believe you are mixing several concepts and options for those concepts, as auto-entities is a completely different beast than the core card options for actions. Especially since you were using mushroomâŚ
and as I already suspected you needed the entity, not just the attribute, so using this.entity_id would seem a logical solution indeed.
what would help, is if youâd post some results. Youâve been scarce in the ask, but now show even less.
great youâve got it working now, please post your final solution, so others might benefit from it.
Is it possible to have and âoptions:â section in a template filter, in auto-entities ?
I am looking for something like below code - see âoptions:âŚâ
(The template does generate the correct entities.
The intent is to have the tap_action set to none for these filtered entities).
Auto-Entities Card to display all entities of this specific input_value entities calling a rest_command and passing over this.entity_id as parameter when tapped (tap_action).