I am currently trying to integrate an image into a mushroom template card instead of an icon. Nevertheless, I would like to ‘configure’ the template card similar to an icon, so I would like to have a circular background behind my image which I can colour according to the status. I would also like to change the size of the image (is truncated) (and the background). Does anyone have a tip on how I can get a background behind the image without the primary and secondary text being on this background? Possibly also how I can increase the distance between the image (or icon) and a badge icon or how I can move the badge icon?
I have made some progress: I now have a round background behind my picture, but I can’t manage to enlarge my picture (it is still cut off at the bottom corners).
Hello, I’m having an issue with my template cards, and I hope someone can help me. I’ve tried making some adjustments, but I can’t get my icons to look like the default ones. The icons appear black instead of grey, and they don’t have the circular backgrounds like the default template icons.
type: custom:mushroom-template-card
entity: switch.waschmaschine
primary: Waschmaschine
secondary: >
{% if is_state('switch.waschmaschine', 'on') and
states('sensor.waschmaschine') in ['arbeitet', 'fertig'] %}
🕒 {{ states('sensor.waschmaschine') | capitalize }} - Seit:
{% set time = as_timestamp(now()) - as_timestamp(states.sensor.waschmaschine.last_changed) %}
{% set hours = (time // 3600) | int %}
{% set minutes = ((time % 3600) // 60) | int %}
{% if hours > 0 %}
{{ hours }} Std. {{ minutes }} Min.
{% else %}
{{ minutes }} Min.
{% endif %}
{% elif is_state('switch.waschmaschine', 'on') %}
{{ states('sensor.waschmaschine') | capitalize }}
{% else %}
{% set no_status = '' %}
{{ no_status }}
{% endif %}
icon: mdi:washing-machine
icon_color: |
{% if is_state('switch.waschmaschine', 'on') %}
blue
{% else %}
gray
{% endif %}
layout: vertical
tap_action:
action: more-info
hold_action:
action: none
double_tap_action:
action: none
card_mod:
style: |
ha-icon {
background-color: var(--card-background-color, #f0f0f0);
border-radius: 50%;
padding: 8px;
--mdc-icon-size: 24px;
}
If that screen shot is accurate, check indentation of the line that starts mushroom-shape-icon - it needs to be indented 2 further spaces (as will as everything underneath it).
If I use a mushroom:cover-card is it possible to change the secondary information and the Icon in one specific position? This code doesnt work, but I cant figured out why. Maybe someone could help. Maybe template-card?