lovelace-mushroom icon indicating copy to clipboard operation
lovelace-mushroom copied to clipboard

[Bug]: Template Card removes Card-Mod entry

Open davidrustingha opened this issue 1 year ago • 7 comments

Requirements

  • [x] I checked the troubleshooting section in the README to verify that I have the latest Mushroom version.
  • [X] I did a search to see if there is a similar issue or if a pull request is open.

Current Behavior

I was working on a new card to show me the waste collector days. I'm making use of the card-mod features for a custom background, blinking colors and icons when a bin will be collected today.

The first card in my horizontal-stack gets their card-mod entry deleted, the rest is still fine. When in edit mode the cards do what i expect them to do, but when I save the card and then reenter the edit mode the card mod entry is gone on the first card.

This also happens when I use a mushroom-template card without a horizontal/vertical-stack and doesn't happen when I use another card

Expected Behavior

No response

Steps To Reproduce

In a normal lovelace dashboard create a new card. Use the code below in a new card. Hit save. The card should show the correct colors etc. Hit edit. The card background color disapears. Hit Show Code Editor. The card-mod entry has been removed from the card, the rest still works as expected.

Context

YAML state

type: custom:mushroom-template-card
primary: PLASTIC
secondary: Over {{ state_attr('sensor.meppel_pmd', 'Days_until') }} dagen.
icon: mdi:trash-can-outline
entity: sensor.meppel_pmd
icon_color: |
  {% if state_attr('sensor.meppel_pmd', 'Days_until') == 3 %}
    orange
  {% elif states('sensor.meppel_morgen') == 'pmd' %}
    red
  {% elif states('sensor.meppel_vandaag') == 'pmd' %}
    green
  {% endif %}
layout: vertical
multiline_secondary: true
card_mod:
  style: |
    @keyframes blink {
      0% {
        border: 
          {% if state_attr('sensor.meppel_pmd', 'Days_until') == 3 %}
            solid 3px orange;
          {% elif states('sensor.meppel_morgen') == 'pmd' %}
            solid 3px red;
          {% elif states('sensor.meppel_vandaag') == 'pmd' %}
            solid 3px green;
          {% endif %}
      }
      100% {
        border: solid 3px var(--primary-background-color);
      }
    }
        
    ha-card {
      animation: 
        {% if state_attr('sensor.meppel_pmd', 'Days_until') == 3 %}
          blink 2s linear infinite;
        {% elif states('sensor.meppel_morgen') == 'pmd' %}
          blink 2s linear infinite;
        {% elif states('sensor.meppel_vandaag') == 'pmd' %}
          blink 2s linear infinite;
        {% else %}
          none;
        {% endif %}
      background: #16181c;
      --primary-text-color: rgb(242, 242, 242);
      --secondary-text-color: rgb(166, 166, 166);
      }
tap_action:
  action: none
hold_action:
  action: none
double_tap_action:
  action: none

Environment

- Browser: Chrome
- HA Version: core:2024.1.0 supervisor:2023.12.0 os:11.2 frontend:20240103.3
- Mushroom: 3.2.2

Anything else?

No response

davidrustingha avatar Jan 05 '24 10:01 davidrustingha

FYI: it still happens on v3.2.3 (I didnt expect it to be fixed already but just so you have all the information). I haven't updated to core2024.1.1 since i've seen a few bugreports with that.

davidrustingha avatar Jan 05 '24 21:01 davidrustingha

Hi @davidrustingha

Are you sure the problem is from mushroom ? I've same problem, but i've try to downgrade mushroom to previous version, the problem is stay.

stephane-r avatar Jan 09 '24 14:01 stephane-r

Hi @stephane-r Yeah im pretty sure the issue comes from Mushroom. I have tried it with diffrent cards and it only happens when using the mushroom template card.

If you have an idea or need me to check something let me know!

davidrustingha avatar Jan 19 '24 16:01 davidrustingha

After latest update, it fixed for me

stephane-r avatar Jan 19 '24 17:01 stephane-r

Weird, I can not reproduce it. I'm not sure it's a Mushroom issue but many people use card mod with template card and don't have this issue.

piitaya avatar Feb 06 '24 17:02 piitaya

Can you even select any Mushroom cards from the "new" menu?

Sectorchan avatar Feb 25 '24 21:02 Sectorchan

I'm having a similar issue with the "view_layout" key used for the Custom Layout Card. card_mod seems to stick around, but view_layout gets removed everytime I go into edit the card and then leave again.

jack3308 avatar Aug 23 '24 06:08 jack3308