Flex-table-card

The error relates to this file being !included from configuration.yaml in a way that is the template key invalid.

template:

You may need to read Splitting up the configuration - Home Assistant to understand how to properly split up your configuration if you want to have this in a separate file.

To be able to help you directly I would need some context.

How are you including the file “packages/package_stampante.yaml”? (what is the line in configuration.yaml you use to do this?)

Mine looks like this

  packages: !include_dir_named db1138/packages

my package files are in /config/db1138/packages/some_package_file.yaml

I just wonder if you could help me out, and make my life a bit better :slight_smile:

I have like 60 nodes that sends Mqtt data to a home assistant “scada unit”.

The data is sent in three packages each depending on how quick they need to be I JSON format.

bild

Then we make sensor out of all the data, like below.

And then to the flex table card and the questions.

I have no problem to list all BatSOC or BatTemp like in the picture imtogether with site name, but I really would like to have it ONE card. Do you have any ideas?
The cards that I have (one for each sensor) looks like below.

bild

I hope you can help me, or at least point the direction for me to solve it.

Your reply is highly appreciated.

Can you make a mock up of what you would like the flex table to look like please? Just a few lines of data would be sufficient.

I currently have an entities card with multiple custom: multiple-entity-rows to match humidity from one sensor to the temperature from another:

title: Current House Temp and Humidity
type: entities
entities:
  - entity: sensor.lumi_lumi_weather_pantryxx_temperature
    name: Pantry
    show_state: false
    type: custom:multiple-entity-row
    secondary_info: last-changed
    entities:
      - entity: sensor.lumi_lumi_weather_pantryxx_temperature
        name: false
      - entity: sensor.pantry_temp_humidity
        name: false
  - entity: sensor.lumi_lumi_weather_6d712c02_temperature
    name: Alfresco
    show_state: false
    type: custom:multiple-entity-row
    secondary_info: last-changed
    entities:
      - entity: sensor.lumi_lumi_weather_6d712c02_temperature
        name: false
      - entity: sensor.lumi_lumi_weather_6d712c02_humidity
        name: false

image

But of course I can only have a fixed sort rather than clickable, which I believe is possible with flex table. Is it possible to “migrate”?
(I can rename the entities to get them to match better)

I would like it to look like “sitename” “state of charge” “Battery temperature” .

Check this
You cannot use flex-table-card to place different entities in columns.

Can you not create a new template that has those 3 fields in it?

1 Like

thats what I thought - was just confirming.

Yes you can.

You will have to create a sensor template entity for each room. From configuration.yaml:

template:
  - sensor:
      - name: Living Room
        state: "Room Entity"
        attributes:
          temperature: '{{ states("sensor.living_room_temperature") }} °F'
          humidity: '{{ states("sensor.living_room_humidity") }}%'
          last_change_time: '{{ relative_time(states.sensor.living_room_temperature.last_changed) }} ago'

      - name: Bedroom
        state: "Room Entity"
        attributes:
          temperature: '{{ states("sensor.bedroom_temperature") }} °F'
          humidity: '{{ states("sensor.bedroom_humidity") }}%'
          last_change_time: '{{ relative_time(states.sensor.bedroom_temperature.last_changed) }} ago'

Then you can use a custom:auto-entities card to select them. I used a fixed state as a selection filter, but you could use a naming convention, group, label, or other method of selection.

The card is then:

type: custom:auto-entities
filter:
  include:
    - state: Room Entity
card:
  type: custom:flex-table-card
  title: Current House Temp and Humidity
  columns:
    - name: ''
      modify: '''<ha-icon icon="mdi:thermometer" style=color:green;></ha-icon>''    '
    - name: Friendly Name
      data: friendly_name
    - name: Last Changed
      data: last_change_time
    - name: Temperature
      data: temperature
    - name: Humidity
      data: humidity

The result:

You can then sort by clicking on a column header.

3 Likes

I’m having problems using this card to display a list of entities with a set of attributes which contain a list of strings. The rows do not display.

I’m having for example the entity binary_sensor.watchdog_ip_device and with the attribute unmanaged_devices:

The card:

- type: 'custom:flex-table-card'
  entities:
    include: binary_sensor.watchdog_ip_device
  clickable: true
  columns:
    - data: icon
      name: ''
    - data: name
      name: Name
    - data: unmanaged_devices
      name: Unmanaged Devices

Shows an empty result:
image

When I remove the attribute containing the list, the table gets populated:

- type: 'custom:flex-table-card'
  entities:
    include: binary_sensor.watchdog_ip_device
  clickable: true
  columns:
    - data: icon
      name: ''
    - data: name
      name: Name

image

How can I display the content of the attribute unmanaged_devices in a separate column?

Figured it out: setting the auto_format card parameter to true did the trick.

Could also be easily solved with this … but the code owner does not respond so not sure it is being kept up:

Is there a way to limit the shown entities to a single HA integration? I would like to show a table with only and all ZHA devices/entities, regardless of how the entities are named.

Read in docs about using with auto-entities. Then use an appropriate filter in auto-entities.

You have a few options here

Jinja templating to create the data for the flex-table card:

All ZHA Entities

{{- integration_entities('zha')-}}

Just the lights

{{- integration_entities('zha')| select('search', '^light\.')| list -}}

And then there’s this little gem (derived from Flex-Table)

Just wanted to say great card! Thanks to some of the ideas from this topic I made this cards showing nearest train departures.

1 Like

hi, how would I do the following

they are all .zha devices and all Innr,

Hello everyone,

I have a problem that is only marginally related to the flex-table. However, I can’t get the trips of my car into the home assistant as a table.

Under the URL http://192.168.2.207:5000/vehicles/trips there is a list of all trips. It looks like this, for example:

[
  {
    "altitude_diff": 0,
    "consumption": 1.38,
    "consumption_km": 12.5454545454545,
    "distance": 11,
    "duration": 22,
    "id": 1,
    "mileage": 431.2,
    "speed_average": 30,
    "start_at": "Mon, 05 Aug 2024 05:09:43 GMT"
  },
  {
    "altitude_diff": 15,
    "consumption": 2.76,
    "consumption_km": 16.8292682926829,
    "distance": 16.4,
    "duration": 42.4666666666667,
    "id": 2,
    "mileage": 447.6,
    "speed_average": 23.1711145996861,
    "start_at": "Mon, 05 Aug 2024 15:12:40 GMT"
  },
  {
    "altitude_diff": -22,
    "consumption": 1.38,
    "consumption_km": 12.3214285714285,
    "distance": 11.2,
    "duration": 18.7333333333333,
    "id": 3,
    "mileage": 463.1,
    "speed_average": 35.8718861209966,
    "start_at": "Tue, 06 Aug 2024 05:37:48 GMT"
  },
  {
    "altitude_diff": 31,
    "consumption": 2.3,
    "consumption_km": 14.7435897435898,
    "distance": 15.6,
    "duration": 22.7166666666667,
    "id": 4,
    "mileage": 479.2,
    "speed_average": 41.2032281731474,
    "start_at": "Tue, 06 Aug 2024 15:18:52 GMT"
  }
]

I would now like to display this data in a table, with time, distance and consumption.

But I can’t manage to transfer the data to a sensor using a RESTful sensor.

I have already tried the following:

  - platform: rest
    name: corsa_e_trips
    resource: http://192.168.2.207:5000/vehicles/trips
    scan_interval: 60
    value_template: "{{ value_json }}"

Then the sensor is unknown. The same occours if i use

    value_template: "{{ value }}"

What works a little is the following:

  - platform: rest
    name: corsa_e_trips
    resource: http://192.168.2.207:5000/vehicles/trips
    scan_interval: 60
    value_template: "{{ value_json | length }}"
    json_attributes:
      - altitude_diff
      - consumption
      - consumption_km
      - distance
      - duration
      - id
      - mileage
      - speed_average
      - start_at

But then I only get the first value in the status attributes, not a list of all values. This of course means that the table-card cannot render a list.

Can someone help me how I can either get the JSON into a property or what I have to adjust so that I can display the trips in a table?

Thank you all very much!

Edit: If someone could try it out and adjust it themselves, that would help me a lot.
The JSON data would be available here: https://my-json-server.typicode.com/tobilektri/hassio-json/corsae

Hello, I have the energi data service that feteches the data of electricity prices every day.

I want to be able to have 24 rows each with the hour of the day. Can I somehow fetch the hour from the “raw_today” attribute?

unit: kWh
raw_today:

  • hour: ‘2024-09-03T00:00:00+02:00’
    price: 2.174
  • hour: ‘2024-09-03T01:00:00+02:00’
    price: 2.113
  • hour: ‘2024-09-03T02:00:00+02:00’
    price: 2.099
  • hour: ‘2024-09-03T03:00:00+02:00’
    price: 2.112
  • hour: ‘2024-09-03T04:00:00+02:00’
    price: 2.141
  • hour: ‘2024-09-03T05:00:00+02:00’
    price: 2.177
  • hour: ‘2024-09-03T06:00:00+02:00’
    price: 2.47
  • hour: ‘2024-09-03T07:00:00+02:00’
    price: 2.699
  • hour: ‘2024-09-03T08:00:00+02:00’
    price: 2.564
  • hour: ‘2024-09-03T09:00:00+02:00’
    price: 2.396
  • hour: ‘2024-09-03T10:00:00+02:00’
    price: 2.236
  • hour: ‘2024-09-03T11:00:00+02:00’
    price: 2.154
  • hour: ‘2024-09-03T12:00:00+02:00’
    price: 2.105
  • hour: ‘2024-09-03T13:00:00+02:00’
    price: 2.085
  • hour: ‘2024-09-03T14:00:00+02:00’
    price: 2.099
  • hour: ‘2024-09-03T15:00:00+02:00’
    price: 2.122
  • hour: ‘2024-09-03T16:00:00+02:00’
    price: 2.165
  • hour: ‘2024-09-03T17:00:00+02:00’
    price: 2.773
  • hour: ‘2024-09-03T18:00:00+02:00’
    price: 3.669
  • hour: ‘2024-09-03T19:00:00+02:00’
    price: 4.766
  • hour: ‘2024-09-03T20:00:00+02:00’
    price: 4.816
  • hour: ‘2024-09-03T21:00:00+02:00’
    price: 3.243
  • hour: ‘2024-09-03T22:00:00+02:00’
    price: 2.557
  • hour: ‘2024-09-03T23:00:00+02:00’

Maybe someone could give me a hint on how to get to the wanted result_