Note: Current code sizes best for desktop viewing. If planning to use on mobile you can change the padding options
Nevermind, I have solved my own problem! I came up with this. It is essentially two mushroom template cards stacked vertically. The bottom card is using card mod to adjust the icon spacing, padding, and size to match what the mushroom lock card button looks like. This way you can set the button’s tap action to whatever you want. I included the code for both a normal layout/size and another for using it in a 2-column grid if anyone would like to use it!
Thanks!
Full Size:
type: custom:stack-in-card
mode: vertical
cards:
- type: custom:mushroom-template-card
primary: Front Door
secondary: >
{% if is_state('binary_sensor.front_door_contact_sensor_intrusion','on')
%}
Door Open
{% elif is_state('lock.front_door','unlocked') %}
Unlocked
{% else %}
Locked
{% endif%}
icon: >-
{% if is_state('binary_sensor.front_door_contact_sensor_intrusion','on')
%}
mdi:door-open
{% elif is_state('lock.front_door','unlocked') %}
mdi:lock-open
{% else %}
mdi:lock
{% endif%}
icon_color: >-
{% if is_state('lock.front_door','locked') and
is_state('binary_sensor.front_door_contact_sensor_intrusion','off') %}
green
{% else %}
red
{% endif%}
badge_icon: >-
{% set battery_level = (states('sensor.front_door_battery') | int / 10) |
round(0) | int * 10 %} {% if battery_level == 100 %} mdi:battery {% elif
battery_level > 0 %} mdi:battery-{{ battery_level }} {% else %}
mdi:battery-alert-variant-outline {% endif %}
badge_color: |-
{% set battery_level = states('sensor.front_door_battery') | int %}
{% if battery_level > 90 %} green
{% elif battery_level > 60 %} light-green
{% elif battery_level > 50 %} lime
{% elif battery_level > 40 %} yellow
{% elif battery_level > 30 %} amber
{% elif battery_level > 20 %} orange
{% elif battery_level > 10 %} deep-orange
{% else %} red
{% endif %}
tap_action:
action: none
hold_action:
action: more-info
- type: custom:mushroom-template-card
primary: ''
secondary: ''
icon: |-
{% if is_state('lock.front_door','locked') %}
mdi:lock-open
{% else %}
mdi:lock
{% endif%}
layout: vertical
entity: script.front_door_lock_and_refresh
tap_action:
action: perform-action
perform_action: script.front_door_lock_and_refresh
target: {}
card_mod:
style:
mushroom-shape-icon$: |
.shape {
--icon-symbol-size: 23px;
--icon-size: 30px;
padding-right: 420px;
padding-left: 10px;
padding-bottom: 10px;
border-radius: 12px !important;
}
.: |
ha-state-icon {
padding-right: 3px;
padding-left: 380px;
padding-bottom: -20px;
height: 15px;
width: 50px;
color: white;
}
ha-card {
margin-top: -19px;
margin-bottom: 1px;
margin-left: 30px;
margin-right: 30px;
}
card_mod:
style: |
ha-card {
{% if is_state('lock.front_door','locked') and
is_state('binary_sensor.front_door_contact_sensor_intrusion','off') %}
background: rgba(101,170,91,0.2);
{% else %}
background: rgba(226,84,66,0.2);
{% endif %}
}
Half Size:
type: custom:stack-in-card
mode: vertical
cards:
- type: custom:mushroom-template-card
primary: Front Door
secondary: >
{% if is_state('binary_sensor.front_door_contact_sensor_intrusion','on')
%}
Door Open
{% elif is_state('lock.front_door','unlocked') %}
Unlocked
{% else %}
Locked
{% endif%}
icon: >-
{% if is_state('binary_sensor.front_door_contact_sensor_intrusion','on')
%}
mdi:door-open
{% elif is_state('lock.front_door','unlocked') %}
mdi:lock-open
{% else %}
mdi:lock
{% endif%}
icon_color: >-
{% if is_state('lock.front_door','locked') and
is_state('binary_sensor.front_door_contact_sensor_intrusion','off') %}
green
{% else %}
red
{% endif%}
badge_icon: >-
{% set battery_level = (states('sensor.front_door_battery') | int / 10) |
round(0) | int * 10 %} {% if battery_level == 100 %} mdi:battery {% elif
battery_level > 0 %} mdi:battery-{{ battery_level }} {% else %}
mdi:battery-alert-variant-outline {% endif %}
badge_color: |-
{% set battery_level = states('sensor.front_door_battery') | int %}
{% if battery_level > 90 %} green
{% elif battery_level > 60 %} light-green
{% elif battery_level > 50 %} lime
{% elif battery_level > 40 %} yellow
{% elif battery_level > 30 %} amber
{% elif battery_level > 20 %} orange
{% elif battery_level > 10 %} deep-orange
{% else %} red
{% endif %}
tap_action:
action: none
hold_action:
action: more-info
- type: custom:mushroom-template-card
primary: ''
secondary: ''
icon: |-
{% if is_state('lock.front_door','locked') %}
mdi:lock-open
{% else %}
mdi:lock
{% endif%}
layout: vertical
entity: script.front_door_lock_and_refresh
tap_action:
action: perform-action
perform_action: script.front_door_lock_and_refresh
target: {}
card_mod:
style:
mushroom-shape-icon$: |
.shape {
--icon-symbol-size: 21px;
--icon-size: 30px;
padding-right: 170px;
padding-left: 10px;
padding-bottom: 10px;
border-radius: 12px !important;
}
.: |
ha-state-icon {
padding-right: 3px;
padding-left: 145px;
padding-bottom: -20px;
height: 12px;
width: 5px;
color: white;
}
ha-card {
margin-top: -19px;
margin-bottom: 1px;
margin-left: 30px;
margin-right: 30px;
}
card_mod:
style: |
ha-card {
{% if is_state('lock.front_door','locked') and
is_state('binary_sensor.front_door_contact_sensor_intrusion','off') %}
background: rgba(101,170,91,0.2);
{% else %}
background: rgba(226,84,66,0.2);
{% endif %}
}