When trying to create my own custom cards using the card_scenes as a starting point, I had it working but after making a few more changes I canāt get it to display on my dashboard anymore. I even reverted the last changes I made to what I had before but that didnāt work either. I restarted HA to make sure everything reloaded.
Nothing is appearing in the error log. Is there a way to debug why a card wonāt appear? If I change the template to ācard_scenesā in the button code it displays properly, so Iām sure something in the template is messed up but canāt figure out what it is.
Button code:
- type: "custom:button-card"
template:
- custom_card_tj335_4scenes
variables:
entity_1:
entity_id: scene.good_morning
icon: "mdi:weather-sunny"
icon_color: "yellow"
name: "Rise"
bg_color: "yellow"
confirm_text: "Toggle the Good Morning scene?"
entity_2:
entity_id: scene.good_morning_with_coffee
icon: "mdi:coffee-maker"
icon_color: "blue"
name: "Rise+"
bg_color: "blue"
confirm_text: "Toggle the Good Morning with Coffee scene?"
entity_3:
entity_id: scene.bedtime
icon: "mdi:bed"
icon_color: "purple"
name: "Bed"
bg_color: "purple"
confirm_text: "Toggle the Bedtime scene?"
entity_4:
entity_id: scene.good_night
icon: "mdi:weather-night"
icon_color: "green"
name: "Nite"
bg_color: "green"
confirm_text: "Toggle the Good Night scene?"
Template code:
---
custom_card_tj335_4scenes:
show_icon: false
show_name: false
show_label: false
variables:
entity_1:
entity_id:
icon: "mdi:help-circle-outline"
icon_color: "gray"
name: "n/a"
bg_color: "gray"
confirm_text: ''
entity_2:
entity_id:
icon: "mdi:help-circle-outline"
icon_color: "gray"
name: "n/a"
bg_color: "gray"
confirm_text: ''
entity_3:
entity_id:
icon: "mdi:help-circle-outline"
icon_color: "gray"
name: "n/a"
bg_color: "gray"
confirm_text: ''
entity_4:
entity_id:
icon: "mdi:help-circle-outline"
icon_color: "gray"
name: "n/a"
bg_color: "gray"
confirm_text: ''
styles:
grid:
- grid-template-areas: "'item1 item2 item3 item4'"
- grid-template-columns: "1fr 1fr 1fr 1fr"
- grid-template-rows: "min-content"
- justify-items: "center"
- column-gap: "auto"
card:
- border-radius: "var(--border-radius)"
- box-shadow: "var(--box-shadow)"
- padding: "12px"
custom_fields:
item1:
card:
type: "custom:button-card"
template: "card_four_scenes_pill"
entity: "[[[ return variables.entity_1.entity_id ]]]"
icon: "[[[ return variables.entity_1.icon ]]]"
name: "[[[ return variables.entity_1.name ]]]"
variables:
color_icon: "[[[ return variables.entity_1.icon_color ]]]"
color_bg: "[[[ return variables.entity_1.bg_color ]]]"
tap_action:
action: "call-service"
confirmation: '[[[ return variables.entity_1.confirm_text == '' ? false : {"text": variables.entity_1.confirm_text} ]]]'
service: "homeassistant.turn_on"
service_data:
entity_id: "[[[ return variables.entity_1.entity_id ]]]"
item2:
card:
type: "custom:button-card"
template: "card_four_scenes_pill"
entity: "[[[ return variables.entity_2.entity_id ]]]"
icon: "[[[ return variables.entity_2.icon ]]]"
name: "[[[ return variables.entity_2.name ]]]"
variables:
color_icon: "[[[ return variables.entity_2.icon_color ]]]"
color_bg: "[[[ return variables.entity_2.bg_color ]]]"
tap_action:
action: "call-service"
confirmation: '[[[ return variables.entity_2.confirm_text == '' ? false : {"text": variables.entity_2.confirm_text} ]]]'
service: "homeassistant.turn_on"
service_data:
entity_id: "[[[ return variables.entity_2.entity_id ]]]"
item3:
card:
type: "custom:button-card"
template: "card_four_scenes_pill"
entity: "[[[ return variables.entity_3.entity_id ]]]"
icon: "[[[ return variables.entity_3.icon ]]]"
name: "[[[ return variables.entity_3.name ]]]"
variables:
color_icon: "[[[ return variables.entity_3.icon_color ]]]"
color_bg: "[[[ return variables.entity_3.bg_color ]]]"
tap_action:
action: "call-service"
confirmation: '[[[ return variables.entity_3.confirm_text == '' ? false : {"text": variables.entity_3.confirm_text} ]]]'
service: "homeassistant.turn_on"
service_data:
entity_id: "[[[ return variables.entity_3.entity_id ]]]"
item4:
card:
type: "custom:button-card"
template: "card_four_scenes_pill"
entity: "[[[ return variables.entity_4.entity_id ]]]"
icon: "[[[ return variables.entity_4.icon ]]]"
name: "[[[ return variables.entity_4.name ]]]"
variables:
color_icon: "[[[ return variables.entity_4.icon_color ]]]"
color_bg: "[[[ return variables.entity_4.bg_color ]]]"
tap_action:
action: "call-service"
confirmation: '[[[ return variables.entity_4.confirm_text == '' ? false : {"text": variables.entity_4.confirm_text} ]]]'
service: "homeassistant.turn_on"
service_data:
entity_id: "[[[ return variables.entity_4.entity_id ]]]"
card_four_scenes_pill:
show_icon: true
show_label: false
show_name: true
variables:
color_icon: "gray"
color_bg: "gray"
styles:
grid:
- grid-template-areas: "'i' 'n'"
- grid-template-columns: "min-content"
- grid-template-rows: "1fr 1fr"
- row-gap: "12px"
- justify-items: "center"
- column-gap: "auto"
card:
- box-shadow: "none"
- padding: "5px"
- box-shadow: >
[[[
if (hass.themes.darkMode){
return "0px 2px 4px 0px rgba(0,0,0,0.80)";
} else {
return "var(--box-shadow)";
}
]]]
- border-radius: "50px"
- place-self: "center"
- width: "52px"
- height: "84px"
icon:
- color: >
[[[
var color = [variables.color_icon];
if (color == "gray"){
var color = "rgba(var(--color-theme),0.20)";
} else if(color == "yellow"){
var color = "rgba(var(--color-yellow),1)";
} else if(color == "blue"){
var color = "rgba(var(--color-blue),1)";
} else if(color == "purple"){
var color = "rgba(var(--color-purple),1)";
} else if(color == "green"){
var color = "rgba(var(--color-green),1)";
} else if(color == "red"){
var color = "rgba(var(--color-red),1)";
}
return color;
]]]
img_cell:
- background-color: >
[[[
var color = [variables.color_bg];
if (color == "gray"){
var color = "rgba(var(--color-theme),0.05)";
} else if(color == "yellow"){
var color = "rgba(var(--color-yellow),0.20)";
} else if(color == "blue"){
var color = "rgba(var(--color-blue),0.20)";
} else if(color == "purple"){
var color = "rgba(var(--color-purple),0.20)";
} else if(color == "green"){
var color = "rgba(var(--color-green),0.20)";
} else if(color == "red"){
var color = "rgba(var(--color-red),0.20)";
}
return color;
]]]
- border-radius: "50%"
- width: "42px"
- height: "42px"
name:
- font-weight: "bold"
- font-size: "9.5px"
- width: "33px"
- padding-bottom: "7px"
state:
- color: "rgba(var(--color-theme),0.9)"
color: "var(--google-grey)"