Open AndLindemann opened 1 year ago
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.
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
Expected behavior Waste collection card displayed
Screenshots
Additional context n/a