Hi,
I’m not a coder but I’m trying to learn based on trial and error and adapting codes from other users.
Currently I’m trying to show an icon in a markdown card. The icon shall be different based on the status of the entity and ideally change the color also.
Currently my code is:
<center>
<table width=300>
<col width=60>
<col width=60>
<col width=60>
<col width=60>
<col width=60>
<tr>
<td><br /> </td>
<td><ha-icon icon="mdi:battery-80"></ha-icon><br /> </td>
<td><ha-icon icon="mdi:ev-station"></ha-icon><br /> </td>
<td><ha-icon icon="mdi:power-plug"></ha-icon><br /> </td>
<td><ha-icon icon="mdi:battery-charging-80"></ha-icon><br /> </td>
</tr>
<tr>
<td><ha-icon icon="phu:audi"></ha-icon><br /> </td>
<td>{{states.sensor.tronity_q4_sportback_e_tron_level.state}} %<br /> </td>
<td>{{states.sensor.tronity_q4_sportback_e_tron_range.state}} km<br /> </td>
<td>{{states.binary_sensor.audi_eingesteckt.state}}<br /> </td>
<td>{{ ha-icon icon="mdi:home-assistant" /ha-icon if is_state('sensor.tronity_q4_sportback_e_tron_plugged', 'True') else ha-icon icon="mdi:home-assistant"/ha-icon }}<br /> </td>
I must admit that I don’t even know what kind of code I’m using, but I found it when I was looking for a way to show this kind of table. Is there a better solution for the table?