Hello,
I have a new questen and I don´t find the right code.
I display the sensor if the on with the following code: {% if is_state('binary_sensor.homematicip_fenster_2', 'on') %} ## Fenster OG Wohnzimmer ist {{ states('binary_sensor.homematicip_fenster_2') | replace("on", "offen") }}{% else %}{% endif %}
Now I would like to add in front of ## Fenster OG Wohnzimmer ist the sensor icon
I have try it with this code: {% if is_state('binary_sensor.homematicip_fenster_2', 'on') %} <ha-icon icon="mdi:{{ states('binary_sensor.homematicip_fenster_2'') }}"/> ## Fenster OG Wohnzimmer ist {{ states('binary_sensor.homematicip_fenster_2') | replace("on", "offen") }}{% else %}{% endif %}
But with this code, I don´t get an output.
I try to sear here, but I don´t find the solution.
Its ok, that me code make an empty markdown card. Because in this markdown card are many sensors. So it is never empty.
I would like to display the “standard” icon from the sensor. The same Icon witch are display when I take the element card.
I need this icon, because I have some sensors with lights and the “standard” icon are automaticly in the right color from the light.
One more thing. If I take this Code:
{% if is_state('binary_sensor.homematicip_fenster_und_turkontakt_mit_magnet', 'on') %} <ha-icon icon="mdi:window-open-variant"></ha-icon> ## Fenster EG Schlafzimmer ist offen{% else %}{% endif %}
the ## not uses. I don´t geht the greater letters by the Text Fenster EG Schlafzimmer ist offen
In the elementscart is the output of the light like this:
And the Icon color is the same as the light and changes the color to the same like the light in real.
If I now output the icon from the attributes, I think the color change is not possible.
Maybe Im not true, but I don´t find the code to get the icon from the attributes of the sensor to try ist out.
But no matter how, if I output the icon before the text is output (no matter how), the formatting with ## is no longer output but only the two ## themselves
I would linke to output linke this (in bigger letters):