I have a flex-table-card that sources data from a script, and allows for updates via tap actions. (The data happens to be stored/persisted in a local todo list.) When I do a tap action, that updates the persistent data, but the flex-table-card doesn’t know this has happened. I’d like to inform the card to re-retrieve the data i.e. to rerun the script that is the data source, after a tap action that I know does updates.
I remembered to have tried this quite a while ago but no longer sure if it is working … did you try this (from the card’s docu)?
flex-table-card/docs/example-cfg-services.md at master · custom-cards/flex-table-card
Thank you for the pointer!
I tried adding another level to the script response data but then the data did not come across, and it the dashboard still didn’t update when the todo lists was updated externally. Here’s what I’m trying:
- type: custom:flex-table-card
entities:
- todo.shows_watch_list <--- with this one we get extra rows of undefined..
<--- so usually I use entities: [ ]
action: script.getshows
target:
entity_id:
- todo.shows_watch_list <--- doesn't seem to update when todo is modifed
columns:
- name: Test
data: items.summary
- name: Title
data: items.entity_id
tap_action:
action: perform-action
perform_action: script.markshowwatched
target:
entity_id: items.entity_id
data:
title: cell[0]
- name: Last
data: items.last
- name: Service
data: items.service
- name: Profile
data: items.profile
- name: Ready
data: items.current
Here’s the script return value, variable “response”:
response:
todo.shows_watch_list: <--- I added this level as per suggestion, but no joy
<--- suggestion I read was to make the top-level look like todo.getitems
<--- without it, the data comes across into the flex-table-card
items:
- entity_id: The Pitt
last: 25-12-18
service: HBO
profile: Erik
current: 'yes'
next: '2026-01-08'
- entity_id: Madmen
last: 25-12-13
next: now
service: Paramount+
profile: Carol
current: 'no'
So, I’m missing something(s), obviously!
(Clearly my data as returned by script is not the same as raw todo.getitems, but read it doesn’t have to be identical…)
I am not sure anylonger how it worked in the past and I donot have a working example.
I did do something different to cover the issue with ‘updated externally’. I created a scripted sensor for my shopping-list which updates when the file changes and this allows me to trigger things too…and from what I read from the docu, the flex-table-card needs an entity that gets updated to refresh itself
Finally got it to work!
Key was putting the same entity id in both places, entities list as well as target. Further, it shouldn’t be the todo list for the entity since that doesn’t update its state on change. (Todo list state is a count of the total number of todo items; doesn’t change when modify individual items.)
action: script.getshows_duplicate
entities:
- input_boolean.flextablecardhelper
target:
entity_id:
- input_boolean.flextablecardhelper
columns:
- name: Title
data: items.entity_id
My “tap action” script toggles this boolean helper after updating the todo list cell, and with this, flex-table-card updates.
When the entities and target are not both present, it will add undesired rows due to the entities list not being empty, but apparently when the same id is supplied for both objects, it doesn’t add those unwanted rows.
Further, it seems that the extra level of JSON is required to be returned by the script (here getshows_duplicate), but the name of the extra level returned by the script doesn’t seem to matter. None-the-less, I choose to use the entity_id passed:
variables:
response:
'{{entity_id[0]}}':
items: '{{ shows }}'
But I had hard coded the key as an old id for the second level and it still worked! In fact I had this:
variables:
response:
entity_id[0]:
items: '{{ shows }}'
which is a typo (didn’t evaluate that JSON key as template but instead literal text), and updating the card still worked!
Thanks again for your help!