I use the following code to display the number of open windows on that card:
{%set state=states('sensor.office_open_windows')%}{% if state | int >= 1 %} W: {{ state }}{% else %}{% endif %}
So if e.g. one window is open it displays “W: 1”. So far so good. However it would look cooler if instead of the W I could display a mdi:window-open icon in front of the counter.
I tried adding mdi:window-open in various ways but I could not get it to work. Btw. I am happy with a static icon, does not have to be dynamic.
And if we aren’t using markdown cards? Standard templates don’t render this markdown
e.g. <ha-icon icon="mdi:home-assistant"></ha-icon>
just displays as-is in the text field.
Here is the code in context (this is a custom row type which supports templating in all fields):
secondary: |
{% set s = (states('sensor.pixel_8_battery_state')|replace('_',' ')|title)%}
{% if s == 'Charging' or s == 'Not Charging' %}
{{s}} - {{ states('sensor.pixel_8_charger_type')|title}}
<ha-icon icon="mdi:home-assistant"></ha-icon>
{% else %}
{{s}}
{% endif %}
That really does not solve the above use case.
I am doing the same. I am looking to use icons in line the secondary information text same as @trevsk1 above. Is ther a way to do this?
This works very well for visually separate dense data on cards.
Such as including last update, battery, and RSI at a glance without taking up large area.
It doesn’t match the HA icons, but they are smaller, and useful. Thank you.
Is there any way to embed two or more icons on a card connected to entities?
Example a smoke detector has both smoke and CO2 entities.
Or is the only solution to create a template alert state to or both, then use the separate text states in the status lines
Smoke: Clear | CO2: Alert
Tried many normal cards and mushroom. Multi entity takes up a ton of screen space for each .