I created an Auto Entities card in an HA dashboard to simply display the temperature and humidity of sensors around my house. I found a thread from 2024 (I think) that described how to set this up using a flex-table-card. Here is the YAML:
And that thread contains examples you need.
Also - always post a code properly FORMATTED. Paste a code inside triple backticks or use a “preformatted” option from a cog menu.
Thank you for the advice! For whatever reason, when I created the original post using an iPad, niether the tick marks nor the preformatted options worked. This time, I used a PC.
All of my sensors support temperature, and only a handful don’t support humidity. As an example, here is what I ended up doing in my templates file:
sensor:
- name: Tesla
state: "Outside"
attributes:
temperature: '{{ states("sensor.red_rocket_inside_temperature_2")}} °F'
humidity: >
{% set hum = states('sensor.red_rocket_inside_humidity_2') %}
{{ hum ~ '%' if hum not in ['unknown', 'unavailable', 'none'] else '' }}
This way, if a sensor has no humidity data, it will just show up blank in that column.
I also modified the card to use icons for the headings as shown here:
If a table presentation of a set of values is needed, a stock Markdown card may be used (markdown supports tables).
In this case each row may contain different entities (in flex-table-card each row must represent one entity).
But Markdown does not support tap_action. So, alternatives may be considered - Heading card, multiple-entity-row.
Also, from what I can tell, the template sensor creates a new entity, and the other entities defined in it are defined as that entity’s attributes. This way, it is sort of a workaround to the single entity limitation. At least I think that’s how it works…
I don’t think there’s needs to be a single entity work around. It may be a limitation of that custom card, but again, it can be worked around using templates instead with auto entities or the markdown card using html to create the table.
Yeah, Ildar stated (in post #4) that a flex-entity-card only supports a single entity per row, so creating the sensor template works very well to get around that.
If you happen to have an example of using a markdown card with html, that would be awesome. I would like to learn how that works, as well.
It would probably be easier for me to just code it out with your entities. Otherwise the examples I have aren’t going to be 1 to 1 with what you need. Can you just post the list of entities you plan to use?
I should also say, there’s a lot of styling that can be done for the table and you can even add HA icons. But I’d need to know what you’re looking for.
I didn’t do anything for formatting in the card itself, I think this is how the default works. I was able to figure out how to suppress “undefined” or “unknown” in the card using some formatting in the tempates.
It would be great to learn how to come up with something comparable using the markdown card. From there, I can experiment with different styles.