Skip to content

External data ​

Auto entities ​

The card can be combined with custom:auto-entities. Auto-Entities then takes care of the filtering, flex-table-card the tabular output.

yaml
type: custom:auto-entities
filter:
  include:
    - entity_id: "/light.luce_*/"
card:
  type: custom:flex-table-card
  title: Auto-Entities Beispiel
  clickable: true
  columns:
    - name: Name
      data: friendly_name
    - name: Status
      data: state

Original example image: Auto-Entities Result

Data from Home Assistant actions ​

Home Assistant moves many larger data structures from attributes into action responses. The flex-table-card can use such answers as a data source.

yaml
type: custom:flex-table-card
title: Wettervorhersage
action: weather.get_forecasts
action_data:
  type: hourly
entities:
  - weather.home
columns:
  - name: Zeit
    data: forecast.datetime
    modify: new Date(x).toLocaleString()
  - name: Temperatur
    data: forecast.temperature
    suffix: " °C"
  - name: Regen
    data: forecast.precipitation_probability
    suffix: "%"

Important: The card updates when a specified entity changes. For action data, there should therefore be a suitable entity under entities.

Original example image: WeatherServiceExample.png

Data from scripts ​

A script can also provide an answer.

yaml
type: custom:flex-table-card
title: Script Beispiel
action: script.test_response
entities: []
columns:
  - name: Name
    data: family.name
  - name: Geburtsjahr
    data: family.year

Example script:

yaml
test_response:
  alias: Test Response
  variables:
    family: >
      {% set myfamily = { "family": [
        { "name": "Emil", "year": 2004 },
        { "name": "Tobias", "year": 2007 },
        { "name": "Linus", "year": 2011 }
      ] } %}
      {{ myfamily }}
  sequence:
    - stop: All Done
      response_variable: family

If entities: [] is used, the top level of the response must directly contain the list structure, for example family.

Original example image: ScriptExample.png

CSV files via command line sensor ​

The flex-table-card does not read files directly. The usual way is a home assistant sensor that converts the file into JSON attributes.

yaml
command_line:
  - sensor:
      name: Water Tank Refill Logs
      command: >
        curl -s http://<HA-IP>:8123/local/WaterTank.csv |
        jq --slurp --raw-input --raw-output
        '{refill_logs: split("\r\n") | .[1:] | map(split(",")) | map({"startTime": .[0],"startVolume": .[1],"endVolume": .[2],"litersDelivered": .[3],"duration": .[4]})}'
      json_attributes:
        - refill_logs
      scan_interval: 3600

Matching card:

yaml
type: custom:flex-table-card
title: Wasser-Tank Befuellung
entities:
  include: sensor.water_tank_refill_logs
columns:
  - name: Start
    data: refill_logs.startTime
    modify: new Date(x).toLocaleString()
  - name: Startvolumen
    data: refill_logs.startVolume
  - name: Endvolumen
    data: refill_logs.endVolume
  - name: Liter
    data: refill_logs.litersDelivered
  - name: Dauer
    data: refill_logs.duration
    suffix: " s"

Original example image: WaterTank.png