UI
UI copied to clipboard
Custom Waste Collection card not working at all
Describe the bug Tried to add the custom paddy_waste_collection card, but it doesn't work at all, throws JS errors in console.
To Reproduce
- type: "custom:button-card"
template:
- custom_card_paddy_waste_collection
entity: sensor.abfall
variables:
ulm_custom_card_paddy_waste_collection_name: paper
ulm_custom_card_paddy_waste_collection_icon: mdi:trash-can
[Error] anonymous@
_evalTemplate@https://..../ui_lovelace_minimalist/cards/button-card/button-card.js:425:73268
@https://..../ui_lovelace_minimalist/cards/button-card/button-card.js:425:73761
forEach@[native code]
_getTemplateOrValue@https://..../ui_lovelace_minimalist/cards/button-card/button-card.js:425:73726
render@https://..../ui_lovelace_minimalist/cards/button-card/button-card.js:425:70749
update@https://..../ui_lovelace_minimalist/cards/button-card/button-card.js:1:19902
performUpdate@https://..../ui_lovelace_minimalist/cards/button-card/button-card.js:1:16788
@https://..../ui_lovelace_minimalist/cards/button-card/button-card.js:1:16447
asyncFunctionResume@[native code]
@[native code]
promiseReactionJobWithoutPromise@[native code]
promiseReactionJob@[native code]
render (button-card.js:425:70844)
update (button-card.js:1:19903)
performUpdate (button-card.js:1:16789)
(anonyme Funktion) (button-card.js:1:16448)
asyncFunctionResume
(anonyme Funktion)
promiseReactionJobWithoutPromise
promiseReactionJob
Expected behavior Waste collection card displayed
Screenshots
Additional context n/a
Somehow it seems the card cannot access the variables:

Dashboard code:
- type: custom:button-card
template: custom_card_paddy_waste_collection
entity: sensor.abfall
variables:
ulm_custom_card_paddy_waste_collection_icon: "mdi:delete"
ulm_custom_card_paddy_waste_collection_name: "Papier"
Card template code:
---
custom_card_paddy_waste_collection:
template:
- "card_generic_swap"
variables:
ulm_card_generic_swap_name: "[[[ return variables.ulm_custom_card_paddy_waste_collection_name; ]]]"
ulm_card_generic_swap_icon: "[[[ return variables.ulm_custom_card_paddy_waste_collection_icon; ]]]"
state:
- operator: "template"
Now if I just replace the
ulm_card_generic_swap_name: "[[[ return variables.ulm_custom_card_paddy_waste_collection_name; ]]]"
ulm_card_generic_swap_icon: "[[[ return variables.ulm_custom_card_paddy_waste_collection_icon; ]]]"
in the template card with fixed strings, the card works. It can't be too difficult to get the card to properly access the variables, but I wasn't able to figure it out. Any hints? It's probably an easy fix, likely something has changed on how variables are handled since the card was last updated and it just needs some minor corrections to get it back to work?
I am having the same issue. Changing the above variables to Strings also fixed it for me.
Seems to be related to https://github.com/UI-Lovelace-Minimalist/UI/pull/783
Slightly different workaround which retains variables:
Card template:
custom_card_paddy_waste_collection:
template:
- "card_generic_swap"
variables:
ulm_card_generic_swap_name: "[[[ return variables.ulm_card_generic_swap_name ]]]"
ulm_card_generic_swap_icon: "[[[ return variables.ulm_card_generic_swap_icon ]]]"
Card:
type: "custom:button-card"
template: custom_card_paddy_waste_collection
entity: sensor.waste_collection_household
variables:
ulm_card_generic_swap_icon: mdi:delete
ulm_card_generic_swap_name: Household
I created a pull request to fix this which is similar to @rust84 solution. https://github.com/UI-Lovelace-Minimalist/UI/pull/1107
This has got me up and running again.