I’m using auto-entities to generate a list of cards that map to ‘chores’ which have a status sensor with a particular state. These cards need to also have a tap_action that triggers a button press on a button entity which each chore has. The button press changes the state of the status sensor (this is what the issue arises from).
For example, one chore could be called MyChore, and would have a status entity called sensor.kc_kid_chore_status_mychore and a button entity called button.kc_kid_chore_approval_mychore.
As a result, my auto-entities card looks like this:
type: custom:auto-entities
card:
type: grid
columns: 1
square: false
card_param: cards
filter:
template: >-
{% set STATES = states | selectattr('entity_id', 'in',
integration_entities('KidsChores')) -%} {%- for STATE in STATES
if '_chore_status_' in STATE.entity_id
and STATE.state == 'claimed' -%}
{%- set ENTITY_ID = STATE.entity_id -%}
{%- set BUTTON_ID = STATE.entity_id.replace('sensor', 'button').replace("status", "approval") -%}
{{
{
'type': 'custom:mushroom-entity-card',
'entity': ENTITY_ID,
'tap_action': {
'action': 'call-service',
'service': 'button.press',
'service_data': {
'entity_id': BUTTON_ID
}
}
}
}},
{%- endfor %}
exclude: []
show_empty: false
This all works, but my problem is that the template isn’t re-evaluated when the button is pressed, so the list of cards is incorrect for the next 10-20 seconds before some internal refresh timer kicks in.
Is there any way for me to tell auto-entities to re-evaluate the template in a script so that the list updates immediately, or a way to configure an include filter to have the same effect as the above code but get the advantage of auto-entities knowing to refresh the list when the status sensor changes value?