I have now used functions for the ‘type’ column. This fixes a problem I had sorting by this column and also highlights the type as red if down.
Using functions may have appeared in this thread already, and I missed it but this useful ‘issue’ in the Github project gives some additional pointers for Flex
Sorry, an you explain a little more. I’m not seeing much difference between your example and my attempt. You treat it as an array in your example with the line:
{%- set ENTITY = config.entities[ROW_INDEX].entity -%}
I am doing the same (but just hard-coded the index for testing purposes).
You also had a similar regex in your include statement.
type: custom:auto-entities
filter:
include:
- entity_id: sensor.rht_sensor_temperature*
card:
type: custom:flex-table-card
sort_by: temp_col-
clickable: true
columns:
- name: Room
data: friendly_name
icon: mdi:home
modify: x.split('RHT Sensor Temperature (')[1].replace(')','')
- name: ""
id: temp_col
data: temperature
icon: mdi:thermometer
suffix: " °C"
modify: parseFloat(x).toFixed(1)
align: center
- name: ""
id: hum_col
data: humidity
icon: mdi:water-percent
suffix: " %"
modify: parseFloat(x).toFixed(0)
align: center
css:
tbody tr+: "background-color: rgba(0,0,0,0) !important;"
thead th: "padding-bottom: 10px !important;"
card_mod:
style: >
{% for ROW_INDEX in range(config.entities|count) -%} {%- set ENTITY =
config.entities[ROW_INDEX].entity -%} {%- set ID = 'entity_row_' + ENTITY
-%} {%- if (states(ENTITY)|float(default=0) < 5) -%}
{%- set COLOR = '#799FCB' -%}
{%- elif (states(ENTITY)|float(default=0) < 13) and
(states(ENTITY)|float(default=0) > 5) -%}
{%- set COLOR = '#95B4CC' -%}
{%- elif (states(ENTITY)|float(default=0) > 13) and
(states(ENTITY)|float(default=0) < 17) -%}
{%- set COLOR = '#AFC7D0' -%}
{%- elif (states(ENTITY)|float(default=0) > 17) and
(states(ENTITY)|float(default=0) < 19) -%}
{%- set COLOR = '#FEC9C9' -%}
{%- elif (states(ENTITY)|float(default=0) > 19) -%}
{%- set COLOR = '#F9665E' -%}
{%- else -%}
{%- set COLOR = 'white' -%}
{%- endif -%}
tbody tr[id^='{{ID}}'] td:nth-child(2) {
color: {{COLOR}};
}
{% endfor %}
grid_options:
columns: 12
rows: auto
I wonder if @Ildar_Gabdullin you might be able to help with another problem. I would like to be able to click on either the temperature value or the humidity value, and have it bring up the relevant graph. At the moment, clicking either of them both brings up the same temperature graph:
You got ONE particular entity (sensor.xxx) with attributes like “temp” & “humidity” - and now expect to see more-info with a graph for a particular attribute? )
Yes I was under the impression we could graph the attributes. But I guess not from what you said.
But I do have in addition the humidity values as their own entities as well (with a state equal to the value of the humidity). Do you know if I can make the table in that way, whilst still preserving your row coloring method (i.e. you said it required auto-entities in order to work).
Something like this I assume would need to be in the filter:
Only custom graph cards can do it.
Not sure about a history-explorer card (which you seem to use in more-info). But if it could - do not think it can show it in more-info. There is no more-info for an attribute.
@teeeeee how did you get the sensor data to pull in just the temp and humi? Are those from the same device? I have Bosch motion / temp / lux devices and I’d like to do what you have done. thx for the advice!
@Ltek Yes, both values come from the same device. I am using the Sonoff SNZB-02 sensors.
This is a zigbee sensor, and I am using Zigbee2MQTT to connect the sensor to Home Assistant. There is a setting in the Zigbee2MQTT page called “Home Assistant legacy attributes”, which will send the humidity value as an attribute for the temperature entity. So you can have both values stored in the same entity (which helps for displaying them both in the same row of the Flex-table-card). There is more detail on this here:
If you don’t have this option available for your sensor, you can always just make a new template sensor, which has the other values you want to display in the table as attributes. For example this might help with that. Documentation for the template sensor attribute syntax is here.
Great info, thank you. To ensure forward compatibility it prob best use a table card with the normal attributes, side-by-side. For a new HA user, all the workarounds are hard to keep track of.
Hi,
this card is overwhelming to be honest. I will just write what I want to do, perhaps someone can help me or point me into the right direction.
I have a sensor, that is “total_increasing”, which captures power data. Now I would like to the 1st measument of a month and the last one. Is this possible to do in the data generation ? Or will I have to make a seperate sensor for this ? Hope you can help me.
Means - you want historical data: each row is for some moment of time.
Not supported, AFAIK.
Consider Google Sheet integration and some automation adding data into a table. But here it is off-topic.
Thats a problem. Google sheets is not an option, because this system is running offline, i can only log in locally.
Perhaps someone else an idea ? Script to convert to a data array ? I hope there is a way…
If the server does not have an access to Internet (and thus Google sheets cannot be used) - then consider a good-old-times writing to a csv file in an automation…
I have seen topics in Configuration about this functionality.
As I said, this is an off-topic. Not sure we should discuss it here - unrelated to flex-table-card since it does not support historical data.