I am pretty much a newb, so I am just piecing together code I find and edit the little bit I figure out.
That code behaved the same as mine. Here is all of the code for the card it’s on (not just the vertical stack like you asked):
type: custom:button-card
name: Living Room
icon: mdi:sofa
tap_action:
action: navigate
navigation_path: living-room
entity: sensor.living_room_temperature
custom_fields:
btn:
card:
type: vertical-stack
cards:
- type: custom:button-card
tap_action:
action: toggle
entity: fan.lr_ceiling_fan
show_name: false
state:
- value: "off"
icon: mdi:fan-off
- value: "on"
icon: mdi:fan
card_mod:
style: |
ha-card {
background: {% if states('fan.lr_ceiling_fan') == 'on' %}
rgba(239,156,102,0.9)
{% else %}
rgba(96,114,116,0.6)
{% endif %}
}
styles:
card:
- padding: 4px
- width: 37px
- height: 37px
- border-radius: 99px
- box-shadow: none
icon:
- width: 25px
- color: rgba(0,0,0,0.5)
- type: custom:button-card
tap_action:
action: toggle
navigation_path: null
entity: cover.lr_blinds
icon: null
show_name: false
state:
- value: closed
icon: mdi:blinds-horizontal-closed
styles:
card:
- background-color: rgba(96,114,116,0.6)
- value: open
icon: mdi:blinds-horizontal
styles:
card:
- background-color: rgba(248,156,116,0.9)
styles:
card:
- padding: 4px
- width: 37px
- height: 37px
- border-radius: 99px
- box-shadow: none
icon:
- width: 25px
- color: rgba(0,0,0,0.5)
- type: custom:button-card
tap_action:
action: toggle
entity: input_boolean.lr_bright
show_name: false
card_mod:
style: |
ha-card {
background: {% if states('input_boolean.lr_bright') == 'on' %} rgba(248,156,116,0.9)
{% else %}
rgba(96,114,116,0.6)
{% endif %}
}
state:
- value: "on"
icon: mdi:brightness-7
- value: "off"
icon: mdi:brightness-5
styles:
card:
- padding: 4px
- width: 37px
- height: 37px
- border-radius: 99px
- box-shadow: none
icon:
- width: 25px
- color: rgba(0,0,0,0.5)
styles:
grid:
- grid-template-areas: "\"n btn\" \"s btn\" \"i btn\""
- grid-template-columns: 1fr min-content
- grid-template-rows: min-content min-content 1fr
card:
- padding: 15px 10px 15px 10px
custom_fields:
btn:
- justify-content: end
- align-self: start
name:
- justify-self: start
- align-self: start
- font-size: 19px
- font-weight: 600
- color: |
[[[
if (states['binary_sensor.lr_devices_all_off'].state == 'on')
return 'rgba(239,156,102,0.9)';
else return 'rgba(96,114,116,0.6)';
]]]
state:
- min-height: 80px
- justify-self: start
- align-self: start
- font-size: 13px
- font-weight: 500
- color: rgba(255,255,255,0.7)
img_cell:
- justify-content: start
- position: absolute
- width: 120px
- height: 120px
- left: 0
- bottom: 0
- margin: 0 0 -25px -25px
- background: |
[[[
if (states['binary_sensor.lr_devices_all_off'].state == 'on')
return 'rgba(239,156,102,0.9)';
else return 'rgba(96,114,116,0.6)';
]]]
- border-radius: 500px
icon:
- width: 60px
- color: black
- opacity: "0.5"
show_state: true
grid_options:
columns: 12