Json Rest Sensor + table_flex_card

Hello, everybody,

I hope someone can put me on the right track :slight_smile:

I’m desperate trying to use a REST sensor that reads a JSON file. Then I want to display the result in a Flex_Table_Card.

The JSON file looks like this.

{
    "visitor": [
   {
      "time": "10:45",
      "name": "customer1",
      "company": "company1"
   },
   {
      "time": "11:45",
      "name": "customer2",
      "company": "company2"
   },
   {
      "time": "12:45",
      "name": "customer3",
      "company": "company3"
   },
   {
      "time": "13:45",
      "name": "customer4",
      "company": "company4"
   },
   {
      "time": "14:45",
      "name": "customer5",
      "company": "company5"
   }
]
}

The table in the Lovelace frontend should look like this at the end.

|| Time  || Name      || Company  ||
|| 10:45 || Customer1 || Company1 ||
|| 11:45 || Customer2 || Company2 ||
|| 12:45 || Customer3 || Company3 ||
|| 13:45 || Customer4 || Company4 ||
|| 14:45 || Customer5 || Company5 ||

This is my sensor:

sensor:
  - platform: rest
    resource: http://XXXXX.XXXX:8040/visitor.json
    name: visitor
    value_template: '{{ value_json }}'

The flex_table configuration looks like this:

- type: 'custom:flex-table-card'
  title: visitor
  entities:
    include: sensor.visitor
  columns:
    - attr_as_list: visitor
      modify: x.time
      name: Time
    - attr_as_list: visitor
      modify: x.name
      name: Name
    - attr_as_list: visitor
      modify: x.company
      name: Company

My very first problem is that the value “State” is greater than 255 characters and I have no clue how to handle it

I would be very grateful for any kind of assistance.

I have found an example of the sensor “UK Transport” but I don’t understand how I can apply it to my application.

Thanks in advance

Hello, did you find a way to manage this?
I believe I have a similar problem, as i am trying to feed the flex table card with data coming from a SQL sensor.
The limit of 255 is on the “state” of the sensor but not on a attribute, so if you find a way to have your JSON in an attribute you can overcome this.
My problem is that i cannot find a way to correctly display the table: in your example x.company or x.time displays “undefined”.
Thank you in advance if you can help!