Itās not a javascript function in this case. Itās an identifier which I search for in the processed template and replace.
The name _is commonly used for localization in several programming languges, though. Thatās why I chose it.
trying to display all GitHub sensors with their respective versions and last_changed on secondary, I canāt find the correct syntax to realize that. Could someone please help me find the template (or maybe direct config setting, tried last_changed obviously, or secondary_info: last-changed but didnāt work) I need?
secondly, Id like to be able to click the entities and reveal more-info. Canāt we tap these template-entity-row 's at all? No handle appears, and clicking does nothingā¦
This is great, thanks. It would be even better if it behaves like a normal card. So when I click it, it would be nice when it opens the entity. Is this possible too?
on my post above, this is solved with the latest update of your custom card, so thank you very much.
I do have another question (next to the open request for tap/hold-action ) which has revealed itself just now. As you can see the auto-entities config makes the sensors appear with the templated state and secondary info, but also with their given name, and default GitHub icon, belonging to the GitHub sensor.
I needed to add a single GitHub sensor to the card config, and without explicitly setting a name and icon this shows as:
Iāve just started using this card and itās awesome, thanks @thomasloven!
I need some help from more experienced people with the following card.
It displays my motion sensors with their statuses (Clear/Detected instead of āoffā/on), secondary info as a value of another (related to entity) sensor and changing its iconās colour dependig on the entity's state.
This is working the version (secondary code shortened for clarity):
As you can see, there is little difference so I wanted to avoid repeating entities. After looking at this and this advice I tried to change my card to:
Entities do change icons when motion detected but states do not change (always Clear) and colour is always blue.
Do I miss anything here or it wonāt work in my case? (I kind of understand how HA detects what entitiesā changes to listen to when rendering templates but people reported success with their config.entity templatesā¦)
It also does not look like I can use any YAML anchors here, does it?
p.s as far as I understand from reading this topic, this card does not support tap_action so if I need such functionality I need to look elsewhere?
yes, both state and active work if I refresh the page.
thatās why I doubted this {{ is_state(config.entity, 'on') }} would ever work properly as itās a template and HA wonāt catch whatās inside config.entity so there will be no re-evaluation and therefore no change (until something else causes re-evaluation)
By the way, when I move some logic from backend to LL (as I used to have some template sensors just to make them read-only like this one) does it shift processing from backend to a browser?
Iām asking because it seems like my sensors react a bit slower now and Iām trying to figure out whyā¦
Thatās very kind of you, thanks!
Just a thought:
I only need to re-define state because (I think) standard LL entity row looks at my binary_sensorās device_class and internally does that off ā Clear/on ā Detected substitution so I donāt see those off/on if I use standard entity row. Maybe your code could do the same?
That way there will be less template processing and generally room for error
On a similar note, I have activeā¦ but itās much trickier considering the recent state of things with dropping colour changes in standard cards.
I just wanted to update my report based on some observation.
Your workaround let me see immediate changes in state but as my secondary info displays time elapsed from the last on state in needs to be updated regularly.
So I ended up having this and it works better as being updated both upon state change and then every minute
Just wanted to say a big thank you for the fix - I downloaded the latest version and it works for me without entity_ids (even without sensor.time - good stuff).
You donāt do releases of it, do you?
@thomasloven I have an issue similar to the previous one when using condition as I want to hide my input_number when an automation is disabled - my card is updated only if I refresh the page.
Hereās the simple config
But there is another problem - that input_number (mode: slider, but mode: box makes no difference) behaves like a sensor so I can see no box around it and cannot change its value.
Could you look into it please?
I recently learned that it is considered normal for template-entity-row to momentarily display its raw templates during a page-refresh (this may be true of other custom cards as well; I donāt know because I donāt use any others). Template-Entity-Row momentarily displays its templates
My point of reference is Custom UI and its templates are never displayed in the UI. Can you explain to a novice like me how Custom UI and template-entity-row differ in their approach?
FWIW, Iām trying to replace Custom UI with purely Lovelace cards and techniques. My requirement is fairly simple: I want to change the icon (and its color) of an entities card based on the entityās state. Iām using style: to set the iconās color and template-entity-row to set the icon. It produces the same appearance as Custom UI but has the additional undesirable feature of showing its templates during rendering.
I chose to display the original template as a fallback. That means that if the template fails to evaluate for any reason, you will be able to at least see it and possibly find out what went wrong.
That also means that on initial load, you will see the template until the backend can evaluate it and send the result back to the frontend.
If I understood you correctly, you are saying the template is displayed by design. In other words, it is entirely feasible to not momentarily display the template but it was decided to display it.
I ask that you reconsider this design choice (or provide an option to enable/disable the display of templates). Hereās why:
From the standpoint of aesthetics, itās unattractive. I canāt recall seeing any web page that, when refreshed, momentarily reveals portions of its raw code prior to rendering it.
If the template has an error, I doubt seeing it flash on the screen for a half-second allows anyone to analyze it.