Hi all
I’m battling to get this to work. I get “Cannot read properties of null (reading ‘config’)” in my card.
This is in my raw file right on top, below title.
button_card_templates:
my_global_fan_style:
variables:
var_off: silver
var_icon_off: white
var_border_on: lime
var_icon_on: lime
styles:
card:
- border-radius: 5px
- border-color: |
[[[
if (states[variables.var_entity].state == 'on') return variables.var_border_on;
return;
]]]
- background: >-
linear-gradient(135deg, rgba(50,50,50,1.0) 0%, rgba(136, 172, 184)
100%)
- box-shadow: |
[[[
if (states[variables.var_entity].state == 'on') return `3px 2px 10px ${variables.var_border_on}`;
return `0px 5px 10px rgba(0, 0, 0, 0.9)`;
]]]
- height: 50px
- width: 55px
icon:
- color: |
[[[
if (states[variables.var_entity].state == 'on') return variables.var_icon_on;
return variables.var_icon_off;
]]]
- height: 35px
name:
- color: var(--text-primary-color)
- font-size: 16px
- text-align: center
label:
- font-size: 18px
- text-align: center
- color: |
[[[
if (states[variables.var_entity].state == 'on') return variables.var_icon_on;
return variables.var_off;
]]]
And this id the button card:
type: custom:button-card
template: my_global_fan_style
icon: mdi:fan-speed-3
name: Kitchen Fan High Too
entity: switch.kitchen_fan_speed_high
tap_action: none
show_icon: true
show_name: true
show_label: false
variables:
var_entity: switch.kitchen_fan_speed_high