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.
yes, + 1 to that indeed.
We have to write correct templates, and have guards to prevent unknownâsâŠ
if anything, an error could be logged stating the template is incorrect. If possible at all, drop the initial momentarily display, and show the evaluated result immediately.
would you consider adding support for state_color? As you can see I know we can use a template there, but as state_color is used in core HA, it might be a valuable addition, and make the config just that bit simpler (and not have to evaluate a jinja template could be beneficial to the system.)
can we have the toggle for a switch, instead of the value for state? dont think I found it in your docâs. If no yet possible, would you consider adding that too please?