Hello, everybody,
I hope someone can put me on the right track
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