Closed testerOfHardware closed 1 year ago
this is an working example:
icon: 'ha:{{ iif(is_state('light.kitchen', 'on'), '<I>mdi:flashlight</I>', '<I>mdi:flashlight-off</I>') }}'
assuming state_attr("sensor.abfallbio", "icon")
is retuning an icon name, you probably need something like this:
icon: 'ha:{{<I>state_attr("sensor.abfallbio", "icon")</I>}}'
thx for the answer. I have only time to try it out on the weekend. so sorry for some days to answer.
But you example
icon: 'ha:{{<I>state_attr("sensor.abfallbio", "icon")</I>}}'
shows me only a dark space in the left column. I tried also to put it on the right side under the clock, also black space. The icon is mdi:leaf, so a normal material icon, that works in HA
I also tried to set a color, still the space is black.
So it is a bug then for me. Or I have to take care of something on the icons that come on the screensaver?
Yes, only icons from here are available, however the leaf icon is there.
You can check templates in the Homeassistant Development tools.
Try this:
{{"<I>"+state_attr("sensor.abfallbio", "icon")+"</I>"}}
FEATURE DESCRIPTION
Pls implement the feature of showing template icons from homeassistant on a screensaver 2 or making me own template, that shows me a dynamic icon, depends on params. I have a garbage sensor, that shows me the correct icon depends on which garbage type i have to bring out in next days. This icon comes from homeassistant icon_template. In homeassistant i can see the icon normal, and works. On the nspanel it shows me just a circle with a exclamation mark.
ADDITIONAL CONTEXT
So in this way i tried what you wrote in a docu, that you can get icon from a template in this way:
but this shows me only the name of the icon, not the icon self.
I tried a simpler version, just to test it:
same result, just a text shows with the name of icon, not the icon self. In this example the icon is coming simple from the icon. I just wanted to test if i can get it through this template, and displaying the icon. But i get just a text with the name of the icon.
So i think, there is no option, to show an icon from a template.
If yes, could you put a working example, pls?
PANEL / FIRMWARE VERION
EU