Probably the main reason of not using table in my setup is that for almost each sensor I have Entities card + graphs + buttons…
It will be great if you share some ideas of using this card.
For me - even only screenshots with description will be fine, w/o code.
Imho, there is TOO much hype & expectations about this “set precision” feature.
May be I am a special person - but I do not use this feature at all.
In many integrations (template, snmp, …) a user already may define any precision.
And this “set precision” feature only affects Frontend - internally states are intact (as it should be).
Again imho - cards should show “raw” intact data, not damaged by any next untested Frontend changes.
Check Github issues - currently people have problems with displaying data with changed precision.
If you really need to change a precision for some data in your flex-table - I recommend to use “modify”.
P.S. Please avoid posting a large code to demonstrate ONE issue. MWE
- type: custom:flex-table-card
entities:
include:
- input_number.test_number_very_small
columns:
- name: value
data: state
- name: value .0
data: state
modify: Number(x).toFixed(0)
- name: value .x
data: state
modify: Number(x).toFixed(1)
- name: value .xx
data: state
modify: Number(x).toFixed(2)
- name: value .xxx
data: state
modify: Number(x).toFixed(3)
- name: value .xxxx
data: state
modify: Number(x).toFixed(4)
- name: value .xxxxx
data: state
modify: Number(x).toFixed(5)
- name: value .xxxxxx
data: state
modify: Number(x).toFixed(6)
But I have 17 columns where I want basically the same logic.
essentially in pseudo:
function getVal (findobj, colattr, valueiferror}{}
Using the above, it would be:
getVal('CLINCH','displayValue','-')
I would assume this is kindof contained here:
But this seems so specific as to not be something that is included in the flex-table, but could not be defined in some property to the table. Am I correct?
If it is an absolutely same code for the “modify” option - consider using a yaml anchor (hope you are a mature man using yaml mode )
If you are thinking about calling a function with different attributes for different columns - then no ((.
As for a “formatter” - imho this is a function accepting ONE variable, i.e. “x”, so we cannot pass attributes.
But - what if our ONE function extracts all needed data from the “x”?
Imagine that “x” may be a complex object, then these inputs may be used in the same function used in all “modify” options for all needed columns.
This may work if you may construct such complex attributes, not if they come “as they are”.
In the spirit of sharing Flex Table setups, here is another one for NHL fans (specifically NHL Fantasy Hockey fans). Flex table with Starting Goalies for today.
first of all thank you for your work with flex-table-card! I was trying to find an easy way to manipulate my batteries cell information and your work just makes it easy. I was trying to acommodate some changes which I would like your confirmation. What I show bellow is a list of sensors which represent individually every cell voltage. I want to be able to change the font color or the background of the cell when it assumes a specific value, I’m sure this is possible, just doing some mistake on the code for sure:
- type: custom:flex-table-card
entities:
include:
- sensor.pylonH221020C30200158_c*
exclude:
- lowest
- highest
columns:
- name: Pack#2
data: state
modify: |-
if ( parseFloat(x) >= 3.480)
'<div style="background-color:#3CB371;">' + x + ' v</div>';
else if ( x >= 3.330)
'<div style="background-color:#e67300;">' + x + ' v</div>';
else if ( x < 3.330)
'<div style="background-color:#cc0000;">' + x + ' v</div>';
align: center
Wondering if would be possible to add as well, the row number automatically before I print the x value. I mean, as we speak I have 15 rows, would nice to have something like the following :
Pack#1
Cell 0: 3.330 v
Cell 1: 3.370 v
Cell 2: 3:380 v
Cell n:
Not sure this helps anyone but I just found out something I had no idea would work based on the documentation for this great card. I have been playing around for the past few hours trying to get a simple tooltip to display on column headers.
I had no idea that the “name” can accept a simple HTML snippet.
So you can do this as a column definition:
- name: '<div title="Total Games Played">GP</div>'