a yes, I forgot about that.
Ive managed to get it to work (and only did so because of the white stripping , without the {%- and others this wont work… )
next challenge is to build the button-card with its templates:
type: custom:button-card
aspect_ratio: 1/1
template:
- support_custom_ui
- styles_name_left
- styles_card
- styles_cf_notification
- styles_img_cell
- plot
- support_custom_ui_notification_border
styles:
card:
- background-color: var(--card-background-color)
- color: var(--primary-color)
custom_fields:
notification: >
[[[ return entity.state + 'W'; ]]]
adding only 1 template like
'template':'support_custom_ui'
there is ok, but trying the list like:
'template':
{'- support_custom_ui',
'- styles_name_left',
'- styles_card',
'- styles_cf_notification',
'- styles_img_cell',
'- plot',
'- support_custom_ui_notification_border'
}
doesnt work, same for the final styles:
or custom_fields:
… this is really tough in an auto-entities templates config.
threw all of these in an extra template:
custom_ui_hack_for_button_card_template:
template:
- support_custom_ui
- styles_name_left
- styles_card
- styles_cf_notification
- styles_img_cell
- plot
- support_custom_ui_notification_border
styles:
card:
- background-color: var(--card-background-color)
- color: var(--primary-color)
and that works ok now how to get the notification in the button-card. Tried to throw that in the same hack template:
custom_ui_hack_for_button_card_template:
aspect_ratio: 1/1
template:
- support_custom_ui
- styles_name_left
- styles_card
- styles_cf_notification
- styles_img_cell
- plot
- support_custom_ui_notification_border
styles:
card:
- background-color: var(--card-background-color)
- color: var(--primary-color)
custom_fields:
notification: >
[[[ var unit = (entity.entity_id.includes('_actueel')) ? ' W' : ' %';
return entity.state + unit; ]]]
et voilá:
advantage over the config-template-card: it auto-updates immediately (albeit in all the buttons for any change, so it might even be a bit much…
lesson learned: if you need a button in an auto-entities template, create a dedicated template with the full button-config to make life easier
thanks Ildar