Probably it is possible with a bit of efforts:
type: vertical-stack
cards:
- type: entities
entities:
- entity: input_boolean.test_boolean
name: show value
- type: custom:badge-card
badges:
- entity: sensor.xiaomi_cg_1_temperature
name: dynamic icon
icon: mdi:fire
card_mod:
style:
ha-state-label-badge $:
ha-label-badge $: |
.badge-container .label-badge .value::after {
{% if is_state('input_boolean.test_boolean','on') %}
content: "{{states(config.entity)}}";
{% endif %}
}
.: |
ha-label-badge ha-state-icon {
{% if is_state('input_boolean.test_boolean','on') %}
display: none;
{% endif %}
}