Closed werbi64 closed 5 months ago
this works:
- type: custom:button-card
entity: automation.afval_morgen
show_state: true
show_name: false
show_label: true
state_display: |
[[[ return helpers.formatDateTime(entity.attributes.last_triggered); ]]]
label: |
[[[ return helpers.relativeTime(entity.attributes.last_triggered); ]]]
can you confirm?
That's how it works : type: custom:button-card entity: automation.alarme_ext_matin name: Alarme Extérieure template:
But when I integrate it into the whole, I get the same error message :
type: custom:button-card show_label: true show_icon: false show_name: false show_state: false template:
What am I doing wrong ?
sorry but I cant read that, please format your code (and take out everything that has nothing to do with those values, leave out all styling )
my guess is then issue is not caused by those helper functions at all (if you say the single card works fine) but caused by some other issue. thats why you need to minimize the code to a working example and build from there
It's better ?
type: custom:button-card entity: automation.alarme_ext_matin show_label: true show_icon: false show_name: false show_state: false tap_action: action: more-info styles: grid:
no, you need to format your code using the <> in the toolbar, select all of the code and then press the button
and for starters, only test the button-card at the bottom to see if that is ok
type: custom:button-card
entity: automation.alarme_ext_matin
show_label: true
show_icon: false
show_name: false
show_state: false
tap_action:
action: more-info
styles:
grid:
- grid-template-areas: '"bouton"'
- grid-template-columns: auto
- grid-template-rows: min-content
custom_fields:
bouton:
card:
type: vertical-stack
cards:
- type: custom:button-card
entity: automation.alarme_ext_matin
name: Alarme Extérieure
layout: icon_name_state2nd
show_state: true
show_name: true
show_label: true
state_display: |
[[[ return helpers.formatDateTime(entity.attributes.last_triggered);
]]]
label: >
[[[ return helpers.relativeTime(entity.attributes.last_triggered);
]]]
better ;-)
now only test the bottom button
(Why on earth are you nesting a button in a button with the same entity? and use a vertical stack for that....)
you seem to have a support question (which should go to the community) and not a bug/issue with the card itself.
Thank you for your peace of mind !
hello,
I want to display last_triggered as a label, Here's my code:
I'm getting an error message:![Capture d’écran du 2024-01-16 22-23-30](https://github.com/custom-cards/button-card/assets/118385034/d19de7e1-af4c-4554-99d9-03f4ab8bac04)
Thank you for everything, your code is fantastic