[Résolu] Question Card_mod + stack in card

Salut à tous
j’aurais juste une question avec card_mod, je l’utilise pour supprimer le fond de ma stack in card
J’utilise :

card_mod:
  style: |
    ha-card {
    background: none;
          }

Sa supprime bien le fond et c’est bien pris en compte
Ce qui me donne ça :
image

Jusqu’ici tout va bien
Mais si je modifie quoi que ce soit le fond revient et le code du card mod disparait.

j’ai testé de mettre le code au tout début à la fin pas de changement
Avec un autre thème pas de changement
En soit c’est pas très gênant car une fois le code enregistré tant que j’y retourne pas c’est ok

Mais si quelqu’un à une idée je suis preneur afin de comprendre mon erreur

voici le code complet au cas ou :

Résumé
type: custom:vertical-stack-in-card
cards:
  - square: false
    type: grid
    cards:
      - square: false
        type: grid
        cards:
          - type: custom:gap-card
            height: 80
          - type: custom:button-card
            tap_action:
              action: call-service
              service: |
                [[[
                  this.dispatchEvent(new Event('hass-toggle-menu', { bubbles: true, composed: true}));
                  return none;
                ]]]
            name: |
              [[[ return states['sensor.time'].state ]]]
            label: |
              [[[ return states['sensor.date_fr'].state ]]]
            show_label: true
            styles:
              grid:
                - grid-template-area: "\"l\" \"n\""
                - grid-template-columns: 1fr
                - grid-template-rows: min-content min-content
              card:
                - height: 100px
                - background: none
                - padding: 0 20px
                - margin-top: "-10px"
                - "--mdc-ripple-press-opacity": 0
              name:
                - justify-self: start
                - align-self: start
                - font-size: 66px
                - font-weight: 300
              label:
                - justify-self: start
                - font-size: 16px
                - font-weight: 300
                - opacity: 0.7
          - type: custom:gap-card
            height: 30
        columns: 1
      - square: false
        type: grid
        cards:
          - type: custom:paper-buttons-row
            styles:
              background: none
              text-shadow: 0px 0px 10px var(--card-background-color);
            buttons:
              - layout: icon|name_state
                state: >-
                  {{ state_attr('weather.forecast_maison_marleo','temperature')
                  }}°C
                image: >
                  {% set mapper =
                    { 'breezy':'cloudy',
                      'clear-night':'clear-night',
                      'clear':'day',
                      'mostly-clear':'day',
                      'clear-day':'day',
                      'cloudy':'cloudy',
                      'fog':'fog',
                      'hail':'rainy-7',
                      'haze':'haze',
                      'lightning':'lightning',
                      'lightning-rainy':'lightning-rainy',
                      'mostly-cloudy':'cloudy',
                      'partlycloudy':'partlycloudy',
                      'partly-cloudy-day':'partly-cloudy-day',
                      'partly-cloudy-night':'partly-cloudy-night',
                      'rainy':'rainy-4',
                      'scattered-showers':'rainy-3',
                      'showers':'rainy-6',
                      'sleet':'sleet',
                      'snow':'snowy-6',
                      'mostly-sunny':'day',
                      'sunny':'day',
                      'sunny':'sunny',
                      'thunderstorm':'thunder',
                      'tornado':'tornado',
                      'wind':'wind',
                      'windy':'wind'} %}
                  {% set state = states('weather.forecast_maison_marleo') %}

                  {% set weather = mapper[state] if state in mapper else
                  'weather' %}

                  {% set path = '/local/ic/weather/' %}

                  {% set ext = '.svg'%}
                    {{[path,weather,ext]|join('')}}
                styles:
                  card:
                    - position: absolute
                    - top: 0px
                    - right: "-6px"
                    - background: none
                    - height: 400px
                    - "--mdc-press-opacity": 0
                  icon:
                    - position: absolute
                    - top: 0px
                    - right: "-50px"
                    - margin-top: "-55px"
                    - height: 300px
                    - width: 300px
                  state:
                    - font-weight: 400
                    - font-size: 30px
                    - letter-spacing: "-1px"
                    - margin-left: 0
                    - margin-top: 200px
                    - display: block
                    - text-align: center
                    - width: 140px
                    - color: white
        columns: 1
    columns: 2
  - type: custom:gap-card
    height: 30
  - type: horizontal-stack
    cards:
      - type: custom:button-card
        entity: calendar.travail
        show_state: false
        show_label: true
        show_name: true
        show_icon: true
        icon: mdi:account-hard-hat
        name: |
          [[[
            if (states['calendar.travail'].state == 'off')
            return "RAS";
            else
            return entity.attributes.message;
          ]]]
        label: |
          [[[
            if (states['calendar.travail'].state == 'off')
            return '';
            else
            return entity.attributes.end_time;
          ]]]
        styles:
          card:
            - height: 100px
            - background: none
            - border-radius: 8px 20px 8px 20px
          name:
            - justify-self: center
            - align-self: center
            - font-size: 30px
            - font-weight: 300
          label:
            - justify-self: center
            - font-size: 16px
            - font-weight: 300
            - opacity: 0.7
          icon:
            - width: 20px
            - color: var(--black)
          img_cell:
            - justify-self: center
            - background: var(--green)
            - border-radius: 100%
            - align-self: start
            - width: 30px
            - height: 30px
      - type: custom:button-card
        entity: calendar.personnel
        show_state: false
        show_label: true
        show_name: true
        show_icon: true
        icon: mdi:home-heart
        name: |
          [[[
            if (states['calendar.personnel'].state == 'off')
            return "RAS";
            else
            return entity.attributes.message;
          ]]]
        label: |
          [[[
            if (states['calendar.personnel'].state == 'off')
            return '';
            else
            return entity.attributes.end_time;
          ]]]
        styles:
          card:
            - height: 100px
            - background: none
            - border-radius: 8px 20px 8px 20px
          name:
            - justify-self: center
            - align-self: center
            - font-size: 30px
            - font-weight: 300
          label:
            - justify-self: center
            - font-size: 16px
            - font-weight: 300
            - opacity: 0.7
          icon:
            - width: 20px
            - color: var(--black)
          img_cell:
            - justify-self: center
            - background: var(--red)
            - border-radius: 100%
            - align-self: start
            - width: 30px
            - height: 30px
  - type: custom:gap-card
    height: 30
  - square: false
    type: grid
    cards:
      - type: custom:paper-buttons-row
        styles:
          gap: 8px
          overflow-x: scroll
          margin: 0px 0px 0 8px
        buttons:
          - icon: mdi:home
            layout: icon
            name: Home
            ripple: none
            tap_action:
              action: navigate
              navigation_path: dashboardsalon
            styles:
              name:
                padding: 0 10px
              button:
                background: var(--gradient-on)
                border-radius: 50%
                color: white
                height: 50px
              icon:
                "--mdc-icon-size": 30px
                color: var(--black)
                width: 55px
                height: 55px
                display: flex
                justify-content: center
                align-items: center
      - type: custom:button-card
        template: raccourcis
        entity: cover.piece_de_vie
        variables:
          name: Volets
          background: var(--gray800)
        tap_action:
          action: toggle
        state:
          - value: closed
            label: Fermée
            icon: mdi:window-shutter
            styles:
              card:
                - background: var(--gray800)
                - width: 120%
              icon:
                - color: black
              name:
                - color: black
              label:
                - color: black
          - value: open
            label: Ouvert
            icon: mdi:window-shutter-open
            styles:
              card:
                - background: var(--gradient-on)
                - width: 120%
              icon:
                - color: black
              name:
                - color: black
              label:
                - color: black
      - type: custom:button-card
        template: raccourcis
        entity: light.led_salon
        variables:
          name: Lumières
          background: var(--gray800)
        state:
          - value: "off"
            label: Eteint
            icon: mdi:lightbulb-group-off
            styles:
              card:
                - background: var(--gray800)
                - width: 120%
              icon:
                - color: black
              name:
                - color: black
              label:
                - color: black
          - value: "on"
            label: Allumée
            icon: mdi:lightbulb-group
            styles:
              card:
                - background: var(--gradient-on)
                - width: 120%
              icon:
                - color: black
              name:
                - color: black
              label:
                - color: black
    columns: 3
  - type: custom:gap-card
    height: 30
card_mod:
  style: |
    ha-card {
    background: none;
          }

Merci

Bonjour,
je ne pense pas que ça soit le souci, mais peut être.
bien respecter les espaces :

card_mod:
  style: |
    ha-card {
      background: none;
    }

tu peux essayer:

card_mod:
  style: |
    ha-card {
      background: none !important;
    }
1 « J'aime »

c’est pas constructif, mais j’adore le [importance faible] dans le titre ! :rofl:

Sinon qu’entends tu exactement par

Comment modifies tu? Que modifies tu? Avec quelle séquence ?

C’est peut être un soucis coté éditeur UI de la vertical-stack-in-card…

1 « J'aime »

Bonjour
j’ai essayer les deux pas de changement

héhé, c’etait pour dire que y’avait pas d’urgence ^^ j’aurais du mettre « priorité »

Dés que je clique sur « modifier » le fond réapparait.

Mais est-ce que le code relatif à cardmod dans le YAML reste ou il est effacé?

Si il est effacé, c’est probablement lié à l’éditeur graphique qui rince une clef qu’il n’attend pas.

PS tu as essayé avec un autre navigateur?

Perso j’utilises tous les jours vertical-stack-in-card et card_mod sans soucis:

mon code
type: custom:vertical-stack-in-card
cards:
  - type: custom:mushroom-template-card
    entity: group.lumieres_salon
    icon: mdi:sofa
    icon_color: |
      {% if is_state(entity, 'on') %}
        #03A9F4
      {% else %}  
        grey
      {% endif %}
    primary: Salon
    secondary: |-
      Alexa: {{ states('sensor.echo_jeanne_temperature') }}°C
      Marsu: {{ states('sensor.alocatia_temperature_2') }}°C
    layout: horizontal
    tap_action:
      action: navigate
      navigation_path: /lovelace-smartphone/salon
    double_tap_action:
      action: navigate
      navigation_path: /lovelace-smartphone/salon
    hold_action:
      action: toggle
    badge_icon: |
      {% if is_state('binary_sensor.echo_salon_mouvement', 'on') %}
        mdi:motion-sensor
      {% else %}  
        mdi:motion-sensor-off
      {% endif %}
    badge_color: |
      {% if is_state('binary_sensor.echo_salon_mouvement', 'on') %}
        orange
      {% else %}  
        grey
      {% endif %}
    multiline_secondary: true
  - type: custom:mushroom-chips-card
    chips:
      - type: template
        entity: plant.alocatia
        icon: mdi:flower
        icon_color: |-
          {% if is_state(entity, 'problem') %} 
           orange
          {% else %}
           grey
          {% endif %}
        tap_action:
          action: fire-dom-event
          browser_mod:
            service: browser_mod.popup
            data:
              title: Plante Marsupilami
              content:
                type: custom:flower-card
                entity: plant.alocatia
                show_bars:
                  - moisture
                  - temperature
                  - illuminance
                  - conductivity
                battery_sensor: sensor.alocasia_zebrina_battery
                display_type: compact
      - type: template
        entity: media_player.echo_jeanne
        icon: mdi:play-pause
        icon_color: |-
          {% if is_state(entity, 'playing') %} 
            #03A9F4
          {% else %}
           grey
          {% endif %}
        tap_action:
          action: fire-dom-event
          browser_mod:
            service: browser_mod.popup
            data:
              title: Echo salon
              content:
                type: custom:stack-in-card
                cards:
                  - type: custom:mini-media-player
                    entity: media_player.echo_jeanne
                    source: full
                    volume_stateless: false
                    group: true
                    artwork: full-cover
                    tts:
                      platform: alexa
                      entity_id: media_player.echo_jeanne
                      type: announce
                    shortcuts:
                      hide_when_off: true
                      columns: 3
                      buttons:
                        - name: Playlist Jeanne
                          type: AMAZON_MUSIC
                          id: Playlist Jeanne
                        - name: RTL2
                          type: custom
                          id: joue la station RTL deux
                        - name: Pop- Rock
                          type: custom
                          id: joue du pop rock
                        - name: Rock
                          type: custom
                          id: joue du rock
                        - name: Musique douce
                          type: custom
                          id: joue de la musique douce
                        - name: Piano
                          type: custom
                          id: joue de la musique au piano
                        - name: Queen
                          type: custom
                          id: joue du Queen
                        - name: Vianney
                          type: custom
                          id: joue du Vianney
                        - name: Louane
                          type: custom
                          id: joue du Louane
                        - name: Playlist Jeanne
                          type: AMAZON_MUSIC
                          id: Playlist Jeanne sur le groupe rez_de_chaussee
                          icon: mdi:multicast
                        - name: RTL2
                          type: custom
                          id: >-
                            joue la station RTL deux sur le groupe
                            rez_de_chaussee
                          icon: mdi:multicast
                        - name: Pop- Rock
                          type: custom
                          id: joue du pop rock sur le groupe rez_de_chaussee
                          icon: mdi:multicast
                        - name: Rock
                          type: custom
                          id: joue du rock sur le groupe rez_de_chaussee
                          icon: mdi:multicast
                        - name: Musique douce
                          type: custom
                          id: >-
                            joue de la musique douce sur le groupe
                            rez_de_chaussee
                          icon: mdi:multicast
                        - name: Piano
                          type: custom
                          id: >-
                            joue de la musique au piano sur le groupe
                            rez_de_chaussee
                          icon: mdi:multicast
                        - name: Queen
                          type: custom
                          id: joue du Queen sur le groupe rez_de_chaussee
                          icon: mdi:multicast
                        - name: Vianney
                          type: custom
                          id: joue du Vianney sur le groupe rez_de_chaussee
                          icon: mdi:multicast
                        - name: Louane
                          type: custom
                          id: joue du Louane sur le groupe rez_de_chaussee
                          icon: mdi:multicast
        hold_action:
          action: navigate
          navigation_path: /lovelace-smartphone/echo
      - type: template
        entity: cover.salon
        hold_action:
          action: toggle
        tap_action:
          action: fire-dom-event
          browser_mod:
            service: browser_mod.popup
            data:
              title: Volets du salon
              content:
                type: vertical-stack
                cards:
                  - type: custom:mushroom-cover-card
                    entity: cover.volet_du_salon_apero
                    name: Volet Apero
                    show_position_control: true
                    show_tilt_position_control: false
                    show_buttons_control: true
                  - type: custom:mushroom-cover-card
                    entity: cover.volet_du_salon_tv
                    name: Volet TV
                    show_position_control: true
                    show_tilt_position_control: false
                    show_buttons_control: true
        icon: |-
          {% if is_state(entity, 'open') %} 
           mdi:window-shutter-open
          {% elif is_state(entity, 'closed') %} 
           mdi:window-shutter
          {% else %}
           mdi:window-shutter-alert
          {% endif %}
        icon_color: |-
          {% if is_state(entity, 'open') %} 
           grey
          {% elif is_state(entity, 'closed') %} 
           grey
          {% else %}
           orange
          {% endif %}
      - type: template
        entity: light.0x84ba20fffe4b2581
        tap_action:
          action: fire-dom-event
          browser_mod:
            service: browser_mod.popup
            data:
              title: Lumières salon
              content:
                type: vertical-stack
                cards:
                  - type: custom:mushroom-light-card
                    entity: light.0x84ba20fffe4b2581
                    name: Petite Lampe
                    use_light_color: true
                    show_brightness_control: true
                    show_color_temp_control: true
                    show_color_control: false
                    collapsible_controls: true
                    tap_action:
                      action: toggle
                  - type: custom:mushroom-light-card
                    entity: light.prise_lampadaire
                    use_light_color: false
                    show_brightness_control: false
                    show_color_temp_control: false
                    show_color_control: false
                    collapsible_controls: true
                    tap_action:
                      action: toggle
                  - type: custom:mushroom-light-card
                    entity: light.prise_elephants
                    use_light_color: false
                    show_brightness_control: false
                    show_color_temp_control: false
                    show_color_control: false
                    collapsible_controls: true
                    tap_action:
                      action: toggle
                  - type: custom:mushroom-light-card
                    entity: light.prise_cerisier
                    use_light_color: false
                    show_brightness_control: false
                    show_color_temp_control: false
                    show_color_control: false
                    collapsible_controls: true
                    tap_action:
                      action: toggle
        icon: mdi:lightbulb
        hold_action:
          action: toggle
        icon_color: |-
          {% if is_state(entity, 'on') %} 
           orange
          {% elif is_state(entity, 'off') %} 
           grey
          {% else %}
           grey
          {% endif %}
    alignment: end
    card_mod:
      style: |
        ha-card {
          padding-top: 0px;
          margin-top: -8px;
          padding-bottom: 8px;
          padding-left: 8px;
          padding-right: 8px;
        }
layout_options:
  grid_columns: 2
  grid_rows: auto

La seule différence que j’y vois c’est que je n’applique pas card mod sur la stack-in-card mais sur les cartes « suivantes »…
D’où ma crainte sur l’éditeur de la stack in card lui même…

Tu peux tenter d’appliquer ton card mod sur chacune des cartes à l’intérieur de ton stack pour voir si ça marche mieux… (en dupliquant du coup le code 1x par carte…)

le code s’efface automatiquement
la seule façon que j’ai trouvé de le récupérer est de cliquer sur annuler ou de le remettre

Avec un autre navigateur, souci identique

Par curiosité j’ai créer une autre type de carte et je n’ai pas de souci, peut être simplement un souci de « compatibilité »

Tu peux tenter d’appliquer ton card mod sur chacune des cartes à l’intérieur de ton stack pour voir si ça marche mieux… (en dupliquant du coup le code 1x par carte…)

Commence par une pour voir…

En tout cas chez moi, quand je copie colle ton code, je ne reproduit pas le problème…

Question bête:
Quel est l’interet de faire un custom:vertical-stack-in-card pour ensuite enlever le background?
Pourquoi ne pas faire « juste » un stack in card normal ou une grille?

Dernière question.
Tu es sur quelle plateforme pour faire ta modif?
PC, Tablette, Smartphone, et quel OS??? Car le soucis vient peut être de là aussi…

Oui, comme le dit @BBE avec stack-in-card, tu as une option pour le background ( et d’autres ):

type: custom:stack-in-card
mode: vertical
keep:
  box_shadow: true
  margin: true
  border_radius: true
  background: false
  outer_padding: false
cards:

Pour le vertical-stack-in-card, je l’ai repris de mon ancien dashboard pour ne pas repartir de zero c’est sans doute une erreur

Je travail sur mon PC en W11
le dashboard est ensuite utilisé sur un NSPanel Pro

merci je vais tester
et remettre au propre le code de la carte

Bonsoir,

Sinon, tu vires stack-in-card, card_mod et tu utilises custom:button-card :smile:

1 « J'aime »

Salut
j’ai remis au propre en prenant simplement une layout card en mode grille
Merci pour vos réponses/conseils

Pb résolu