This is just a discussion on a SIMPLE matter. Nobody here “banging his head” or wants to create a revolution.
What I see is
and this is IMHO expected since the “icon_color” is not defined inside a states object.
Sorry, missed the next part about customization.
Yes, since this attribute IS customized - it is ADDED and may be accessed
yep, that’s what I tried to show indeed.
Marius, I edited my post after you wrote your reply.
As for the template sensor - again , you added an attribute which is accessible as a part of states object (whether it is used for coloring in Frontend or not - cannot say anything).
Finally, you ADDED attributes either by customization or as a part of template sensor - then yes, they are accessible.
No problem, already thanked you for participation, and next time please use idioms properly.
but only those I mentioned. The custom-ui template attributes are Not listed in the Jinja template, even though they Are listed in the dev tools states attributes list.
I now remember we had to be creative when adding a custom:button-card template to access those:
# https://github.com/custom-cards/button-card/issues/419
support_custom_ui:
## icon: |
## [[[
## if (entity && entity.attributes && entity.attributes.templates) {
## const tpl = entity.attributes.templates;
## if (tpl.icon) {
## return new Function('state', `'use strict'; ${tpl.icon}`).call(this, entity.state);
## }
## }
## return null;
## ]]]
styles:
icon:
- color: |
[[[ if (entity && entity.attributes && entity.attributes.templates) {
const tpl = entity.attributes.templates;
if (tpl.icon_color) {
return new Function('state',`'use strict';${tpl.icon_color}`).call(this, entity.state);
}
}
return null; ]]]
Not saying you can use this in the backend, this is all Frontend. Just providing as much info on the icon(_color) attribute under the given circumstances, so you can see if that helps you.
Now be nice again to Chris You blaming him is a bit out of order here I am afraid.
Well, actually inaccessibility of “icon” attribute is not a problem for me at all, that was just a matter of curiosity “wth this attribute may not be accessed”.
Surely there are ways to customize icons, colors etc. It was even advised here to have a look at card-mod ))
He seemed to get irritated that I was keeping discussing this icon issue. It was his choice.