No idea. I have tried dozens of combinations to flex-table and none work as they should. I am likely going to abandon it as it is lame and really can only handle data one level deep. If anyone has an example otherwise, I would love to see it but I can write jinja all dat long to get at everything, but the data selector just cannot more than one level.
Take the simplest of all examples as I see it:
type: custom:flex-table-card
title: Standings
sort_by: place
entities:
include: sensor.nhl_standings
columns:
- name: Name
data: children
modify: |
'<div>' + x.name + '</div>'
align: left
This works and gives you this:
So lets try to go one level deeper.
type: custom:flex-table-card
title: Standings
sort_by: place
entities:
include: sensor.nhl_standings
columns:
- name: Name
data: children.children[0]
modify: |
'<div>' + x.name + '</div>'
align: left
Yet it should work. Let’s prove it … let’s change the it just a bit
type: custom:flex-table-card
title: Standings
sort_by: place
entities:
include: sensor.nhl_standings
columns:
- name: Name
data: children
modify: |
'<div>' + x.children[0].name + '</div>'
align: left
And this shows two things.
(1) The data selector cannot be more than one level deep. If someone can prove it can, show me I would love to see it.
(2) This makes it totally unusable for this application because it will only iterate over the “data” which is children which will always be two in this case (one for each conference). And here is the proof for that:
type: custom:flex-table-card
title: Standings
sort_by: place
entities:
include: sensor.nhl_standings
columns:
- name: Name
data: children
modify: |
'<div>' + x.children[0].standings.entries[0].team.name + '</div>'
align: left
Two teams. Not every team because it iterates over the data: which has two conferences so you only get two teams. And because it appears (not as their documentation states) that you can put paths into the data: YAML, it does not work for anything more than one level.
In other words, someone show an example like this which I cannot find anywhere:
data: level1.level2.level3
While their documentation states you can, I am sorry … it does not work.
Now, I can easily do this in templates:
{% for entry in state_attr('sensor.nhl_standings','children')[0].children[0].standings.entries | list %}
{{ entry.team.name }}
{% endfor %}
So in templates one could easily build out what is needed. Problem is throwing that into Markdown a’int the prettiest things but I guess if one one has a solution then that is the way to go. In fact, the more I thin about it I think injecting a table in markdown is the way because one markdown card can have all the stats.
On to writing it