Créer une grille Bubble card

Bonjour,

Je commence à me faire mon Dashboard avec des Bubble card.
J’essai de faire une grille horizontale avec des Bubble card chacune nommé avec le nom de la pièce.
Par la suite j’aimerais intégrer à cette Bubble des icônes (lumière, volet, et musique)

J’ai fais un code yaml ci dessous :

type:%20custom%3Abubble-card%0Atitle%3A%20Chambre%0Ashow_name%3A%20true%0Ashow_icon%3A%20true%0Aicon%3A%20mdi%3Abed-king%0Atabs%3A%0A%20%20-%20title%3A%20Lumi%C3%A8re%0A%20%20%20%20icon%3A%20mdi%3Alightbulb%0A%20%20%20%20icon_color%3A%20yellow%0A%20%20-%20title%3A%20Volet%0A%20%20%20%20icon%3A%20mdi%3Ablinds%0A%20%20%20%20icon_color%3A%20blue%0Acard_type%3A%20separator%0Ahash%3A%20%22%23kitchen%22%0A

Rien ne s’affiche sur le dash, il semble qu’il faut préciser le type de carte. Mais lequel prendre ? Je les ai tous essayé dans la liste mais il m’affiche des erreurs ou rien….

Si vous avez une idée.
Merci à vous.

Ma configuration


Texte à remplacer par votre configuration

Comment récupérer ma configuration :
Dans votre HA, Menu latéral Paramètres > Système > Corrections puis les trois petits points en haut a droite > Informations Système puis une fois en bas Copier


Salut

Tu as fait comment pour créer ta carte, tu as utilisé l’interface ou tu as collé un code Yaml, car ton code ne correspond a rien.

Tu devrais avoir un code qui ressemble à ceci

type: grid
cards:
  - type: horizontal-stack
    cards:
      - type: custom:bubble-card
        card_type: button
        entity: switch.buanderie

Salut

Soit tu as raté ton copié/collé, soit ton yaml est complètement faux.
En tout cas, là c’est pas exploitable

Merci mais ca ne fonctionne pas comme je le souhaite…

Voici mon code actuel :

square: true
type: grid
columns: 2
cards:
  - show_name: true
    show_icon: true
    type: button
    name: Salon
    icon: mdi:sofa
    tap_action:
      action: navigate
      navigation_path: /test-3/1
    show_state: false
  - type: button
    name: Chambre Parents
    icon: mdi:bed-king
    tap_action:
      action: navigate
      navigation_path: /lovelace/chambre_parents
  - type: button
    name: Chambre Adrien
    icon: mdi:bed-king
    tap_action:
      action: navigate
      navigation_path: /lovelace/salon
  - type: button
    name: Chambre Maxime
    icon: mdi:bed-king
    tap_action:
      action: navigate
      navigation_path: /lovelace/chambre_parents
  - type: button
    name: Salle de bain parents
    icon: mdi:shower
    tap_action:
      action: navigate
      navigation_path: /lovelace/salon
  - type: button
    name: Salle de bain enfants
    icon: mdi:shower
    tap_action:
      action: navigate
      navigation_path: /lovelace/chambre_parents

je souhaite modifier ce yaml actuel pour basculer sur des bubble cards, et j’aimerai que chaque bubble de pièce comporte chacune 3 logos, un avec une lampe, 1 avec une enceinte et un autre avec un volet.
Que chaque logo renvoie l’état de l’entité, jaune actif et ton sur ton inactif.

comme sur cet exemple :

Capture d’écran 2025-04-14 à 15.39.57

Ca me permet d’un coup d’oeil d’avoir le retour d’état, et si je clique sur la bubble j’ai plus d’infos et d’interaction possible : diminuer la lumière, baisser le volet, avoir la temperature etc…

je sais pas si vous comprenez mon idée ?

Hello,

il y aura du ménage à faire mais la base est là, c’est une bubble popup que j’ai adapté à la va vite

image

type: custom:bubble-card
card_type: button
entity: cuisine
show_icon: true
icon: mdi:alarm
hash: "#menu"
card_layout: normal
width_desktop: 400px
sub_button:
  - icon: mdi:door
    show_state: false
    show_background: true
    show_attribute: false
    show_name: true
    tap_action:
      action: navigate
      navigation_path: "#entree"
  - icon: mdi:room-service
    show_state: false
    show_background: true
    show_attribute: false
    show_name: true
    tap_action:
      action: navigate
      navigation_path: "#cagibi"
  - icon: mdi:silverware
    show_state: false
    show_background: true
    show_attribute: false
    show_name: true
    tap_action:
      action: navigate
      navigation_path: "#cuisine"
styles: |
  .bubble-button-card-container {
    box-shadow: none;
    border-radius: 15px !important;  # Ajustez la valeur ici pour l'arrondi de la carte
  }
  .bubble-sub-button-container {
    width: 100% !important;  # Étend la largeur sur toute la carte
    display: flex !important;
    justify-content: left !important;  # Centre les sous-boutons horizontalement
    align-items: center !important;  # Aligne les boutons verticalement
  }
  .bubble-name-container {
    margin-right: 200px !important;
  }
  .bubble-sub-button:active {
    background-color: rgba(0, 123, 255, 0.5); /* Couleur bleue semi-transparente */
  }
close_on_click: true
name: Menu
show_name: false

cdt

Bonsoir, sinon, tu laisses tomber bubble-card et tu testes custom:button-card :grin:

Un exemple de carte de données atmosphériques avec uniquement du custom:button-card qui s’affiche correctement sur PC, tablette ou téléphone portable (pour @WarC0zes et @FROlCi) :

essai

Les prévisions étant identiques aux données d’aujourd’hui, le gif n’est pas très parlant. :grin:

Le code de la carte « Données atmosphériques » pour Lyon 2ème avec ajout de boutons pour afficher les données du jour ou les prévisions pour le lendemain :

button_card_templates:
  atmo_template:
    variables:
      sensor_niveau: ''
      sensor_concentration: ''
      nom_legende: ''
      icone: none
      afficher_icone: true
      afficher_legende: true
      afficher_concentration: true
      hauteur_carte: 54px
    custom_fields:
      icone:
        card:
          type: custom:button-card
          entity: '[[[ return variables.sensor_niveau ]]]'
          icon: '[[[ return variables.icone ]]]'
          show_state: false
          show_name: false
          show_icon: true
          styles:
            card:
              - background: none
              - border-radius: 0
              - border: none
            icon:
              - width: 100%
              - color: |
                  [[[
                    return states[variables.sensor_niveau]?.attributes?.Couleur || '#DDDDDD';
                  ]]]
      legende:
        card:
          type: custom:button-card
          entity: '[[[ return variables.sensor_niveau ]]]'
          show_state: false
          name: '[[[ return variables.nom_legende ]]]'
          show_icon: false
          styles:
            card:
              - background: none
              - height: 32px
              - border-radius: 0
              - border: none
              - padding-top: 0px
              - padding-bottom: |
                  [[[
                    return variables.nom_legende.includes('<br>') ? '10px' : '0px';
                  ]]]
            name:
              - font-size: 0.6em
              - color: |
                  [[[
                    return states[variables.sensor_niveau]?.attributes?.Couleur || '#DDDDDD';
                  ]]]
              - text-align: left
              - width: 100%
      concentration:
        card:
          type: custom:button-card
          entity: '[[[ return variables.sensor_concentration ]]]'
          show_state: false
          name: |
            [[[
              const value = states[variables.sensor_concentration]?.state;
              return `${value} µg/m³`;
            ]]]
          show_icon: false
          styles:
            card:
              - background: none
              - height: 32px
              - border-radius: 0
              - border: none
              - padding-top: 0px
              - padding-bottom: 0px
            name:
              - font-size: 0.6em
              - white-space: normal
              - line-height: 0.9
              - color: |
                  [[[
                    return states[variables.sensor_niveau]?.attributes?.Couleur || '#DDDDDD';
                  ]]]
              - text-align: right
              - width: 100%
      jauge:
        card:
          type: custom:button-card
          entity: '[[[ return variables.sensor_niveau ]]]'
          show_state: false
          show_name: false
          show_icon: false
          custom_fields:
            valeur: ''
          styles:
            card:
              - height: |
                  [[[
                    if (!variables.afficher_icone && !variables.afficher_legende && !variables.afficher_concentration) {
                      return '30px';
                    } else {
                      return '24px';
                    }
                  ]]]
              - background-color: |
                  [[[
                    const hex = states[variables.sensor_niveau]?.attributes?.Couleur || '#DDDDDD';
                    const bigint = parseInt(hex.replace('#',''), 16);
                    const r = (bigint >> 16) & 255;
                    const g = (bigint >> 8) & 255;
                    const b = bigint & 255;
                    return `rgba(${r},${g},${b}, 0.3)`;
                  ]]]
              - border-radius: |
                  [[[
                    if (!variables.afficher_icone && !variables.afficher_legende && !variables.afficher_concentration) {
                      return '15px';
                    } else {
                      return '12px';
                    }
                  ]]]
              - border: none
              - overflow: hidden
              - position: relative
            custom_fields:
              valeur:
                - position: absolute
                - top: 0
                - left: 0
                - height: 100%
                - background-color: |
                    [[[
                      return states[variables.sensor_niveau]?.attributes?.Couleur || '#DDDDDD';
                    ]]]
                - border-top-left-radius: 12px
                - border-bottom-left-radius: 12px
                - border-top-right-radius: 0px
                - border-bottom-right-radius: 0px
                - width: |
                    [[[
                      const val = parseInt(states[variables.sensor_niveau]?.state || '0');
                      const clamped = Math.min(Math.max(val, 0), 6);
                      return `${(clamped * 100 / 6).toFixed(1)}%`;
                    ]]]
      niveau:
        card:
          type: custom:button-card
          show_state: false
          name: |
            [[[
              return states[variables.sensor_niveau]?.attributes?.Libellé;
            ]]]
          show_icon: false
          styles:
            card:
              - height: |
                  [[[
                    if (!variables.afficher_icone && !variables.afficher_legende && !variables.afficher_concentration) {
                      return '30px';
                    } else {
                      return '24px';
                    }
                  ]]]
              - background-color: transparent
              - border-radius: |
                  [[[
                    if (!variables.afficher_icone && !variables.afficher_legende && !variables.afficher_concentration) {
                      return '15px';
                    } else {
                      return '12px';
                    }
                  ]]]
              - border: 2px rgba(32,32,32,0.5) inset
              - overflow: hidden
              - position: relative
            name:
              - position: absolute
              - top: 50%
              - left: 50%
              - transform: translate(-50%, -50%)
              - color: white
              - font-size: 0.6em
              - font-weight: bold
              - text-shadow: 1px 1px 2px black
    styles:
      card:
        - background: none
        - width: |
            [[[
              if (window.innerWidth <= 600) {
                if (!variables.afficher_icone && !variables.afficher_legende && !variables.afficher_concentration) {
                  return '105px';
                } else {
                  return '170px';
                }
              } else {
                if (!variables.afficher_icone && !variables.afficher_legende && !variables.afficher_concentration) {
                  return '140px';
                } else {
                  return '223px';
                }
              }
            ]]]
        - height: '[[[ return variables.hauteur_carte ]]]'
        - border: none
        - position: relative
        - pointer-events: none
      custom_fields:
        icone:
          - display: '[[[ return variables.afficher_icone ? "block" : "none" ]]]'
          - position: absolute
          - left: 2%
          - top: 3%
          - width: 10%
        legende:
          - display: '[[[ return variables.afficher_legende ? "block" : "none" ]]]'
          - position: absolute
          - left: 14%
          - top: 1%
          - width: 80%
        concentration:
          - display: '[[[ return variables.afficher_concentration ? "block" : "none" ]]]'
          - position: absolute
          - right: 3%
          - top: 1%
          - width: 30%
        jauge:
          - position: absolute
          - left: 2%
          - top: |
              [[[
                if (!variables.afficher_icone && !variables.afficher_legende && !variables.afficher_concentration) {
                  return '1%';
                } else {
                  return 'auto';
                }
              ]]]
          - bottom: |
              [[[
                if (!variables.afficher_icone && !variables.afficher_legende && !variables.afficher_concentration) {
                  return 'auto';
                } else {
                  return '5%';
                }
              ]]]
          - width: 96%
        niveau:
          - position: absolute
          - left: 2%
          - top: |
              [[[
                if (!variables.afficher_icone && !variables.afficher_legende && !variables.afficher_concentration) {
                  return '1%';
                } else {
                  return 'auto';
                }
              ]]]
          - bottom: |
              [[[
                if (!variables.afficher_icone && !variables.afficher_legende && !variables.afficher_concentration) {
                  return 'auto';
                } else {
                  return '5%';
                }
              ]]]
          - width: 96%
views:
  - title: Home
    cards:
      - type: custom:button-card
        name: Données atmosphériques
        variables:
          day_selected: today
        custom_fields:
          previous:
            card:
              type: custom:button-card
              icon: mdi:play
              tap_action:
                action: call-service
                service: input_select.select_option
                service_data:
                  entity_id: input_select.maison_selection_jour_atmo_france
                  option: today
              styles:
                card:
                  - aspect-ratio: 1/1
                  - align-items: center
                  - width: |
                      [[[
                        return window.innerWidth <= 600 ? '22px' : '26px';
                      ]]]
                  - background-color: gray
                  - border-radius: 0
                  - border: none
                  - border-top-left-radius: 10px
                  - border-bottom-left-radius: 10px
                  - opacity: |
                      [[[
                        return states['input_select.maison_selection_jour_atmo_france'].state === 'today' ? '0.5' : '1';
                      ]]]
                  - pointer-events: |
                      [[[
                        return states['input_select.maison_selection_jour_atmo_france'].state === 'today' ? 'none' : 'auto';
                      ]]]
                  - cursor: |
                      [[[
                        return states['input_select.maison_selection_jour_atmo_france'].state === 'today' ? 'auto' : 'pointer';
                      ]]]
                icon:
                  - width: 100%
                  - rotate: 180deg
                  - opacity: 50%
          day:
            card:
              type: custom:button-card
              name: >
                [[[ return
                states['input_select.maison_selection_jour_atmo_france'].state
                === 'today' ? 'J' : 'J+1'; ]]]
              styles:
                card:
                  - align-items: center
                  - width: 44px
                  - height: |
                      [[[
                        return window.innerWidth <= 600 ? '22px' : '26px';
                      ]]]
                  - background-color: gray
                  - border-radius: 0
                  - border: none
                  - pointer-events: none
                  - cursor: auto
                name:
                  - font-size: 1em
                  - font-weight: bold
                  - opacity: 50%
          next:
            card:
              type: custom:button-card
              icon: mdi:play
              tap_action:
                action: call-service
                service: input_select.select_option
                service_data:
                  entity_id: input_select.maison_selection_jour_atmo_france
                  option: tomorrow
              styles:
                card:
                  - aspect-ratio: 1/1
                  - align-items: center
                  - width: |
                      [[[
                        return window.innerWidth <= 600 ? '22px' : '26px';
                      ]]]
                  - background-color: gray
                  - border-radius: 0
                  - border: none
                  - border-top-right-radius: 10px
                  - border-bottom-right-radius: 10px
                  - opacity: |
                      [[[
                        return states['input_select.maison_selection_jour_atmo_france'].state === 'tomorrow' ? '0.5' : '1';
                      ]]]
                  - pointer-events: |
                      [[[
                        return states['input_select.maison_selection_jour_atmo_france'].state === 'tomorrow' ? 'none' : 'auto';
                      ]]]
                  - cursor: |
                      [[[
                        return states['input_select.maison_selection_jour_atmo_france'].state === 'tomorrow' ? 'auto' : 'pointer';
                      ]]]
                icon:
                  - width: 100%
                  - opacity: 50%
          indice_air:
            card:
              type: custom:button-card
              name: Qualité<br>de l'air
              custom_fields:
                jauge_air:
                  card:
                    type: custom:button-card
                    template: atmo_template
                    variables:
                      sensor_niveau: |
                        [[[
                          const jour = states['input_select.maison_selection_jour_atmo_france']?.state;
                          const base = 'sensor.qualite_globale_lyon';
                          return jour === 'tomorrow' ? base + '_j_1' : base;
                        ]]]
                      afficher_icone: false
                      afficher_legende: false
                      afficher_concentration: false
                jauge_pm10:
                  card:
                    type: custom:button-card
                    template: atmo_template
                    variables:
                      sensor_niveau: |
                        [[[
                          const jour = states['input_select.maison_selection_jour_atmo_france']?.state;
                          const base = 'sensor.pm10_lyon';
                          return jour === 'tomorrow' ? base + '_j_1' : base;
                        ]]]
                      sensor_concentration: none
                      nom_legende: >-
                        Particules fines inférieures<br>à 10 micromètres (PM
                        <sub>10</sub>)
                      icone: mdi:blur
                      afficher_icone: true
                      afficher_legende: true
                      afficher_concentration: false
                jauge_pm25:
                  card:
                    type: custom:button-card
                    template: atmo_template
                    variables:
                      sensor_niveau: |
                        [[[
                          const jour = states['input_select.maison_selection_jour_atmo_france']?.state;
                          const base = 'sensor.pm25_lyon';
                          return jour === 'tomorrow' ? base + '_j_1' : base;
                        ]]]
                      sensor_concentration: none
                      nom_legende: >-
                        Particules fines inférieures<br>à 2.5 micromètres (PM
                        <sub>2.5</sub>)
                      icone: mdi:blur
                      afficher_icone: true
                      afficher_legende: true
                      afficher_concentration: false
                jauge_no2:
                  card:
                    type: custom:button-card
                    template: atmo_template
                    variables:
                      sensor_niveau: |
                        [[[
                          const jour = states['input_select.maison_selection_jour_atmo_france']?.state;
                          const base = 'sensor.dioxyde_d_azote_lyon';
                          return jour === 'tomorrow' ? base + '_j_1' : base;
                        ]]]
                      sensor_concentration: none
                      nom_legende: Dioxyde d'azote (NO<sub>2</sub>)
                      icone: mdi:molecule
                      afficher_icone: true
                      afficher_legende: true
                      afficher_concentration: false
                jauge_o3:
                  card:
                    type: custom:button-card
                    template: atmo_template
                    variables:
                      sensor_niveau: |
                        [[[
                          const jour = states['input_select.maison_selection_jour_atmo_france']?.state;
                          const base = 'sensor.ozone_lyon';
                          return jour === 'tomorrow' ? base + '_j_1' : base;
                        ]]]
                      sensor_concentration: none
                      nom_legende: Ozone (O<sub>3</sub>)
                      icone: mdi:molecule
                      afficher_icone: true
                      afficher_legende: true
                      afficher_concentration: false
                jauge_so2:
                  card:
                    type: custom:button-card
                    template: atmo_template
                    variables:
                      sensor_niveau: |
                        [[[
                          const jour = states['input_select.maison_selection_jour_atmo_france']?.state;
                          const base = 'sensor.dioxyde_de_soufre_lyon';
                          return jour === 'tomorrow' ? base + '_j_1' : base;
                        ]]]
                      sensor_concentration: none
                      nom_legende: Dioxyde de soufre (SO<sub>2</sub>)
                      icone: mdi:molecule
                      afficher_icone: true
                      afficher_legende: true
                      afficher_concentration: false
              styles:
                card:
                  - background: >
                      linear-gradient(135deg, rgba(64,64,64,1) 0%,
                      rgba(96,96,96,1) 25%, rgba(128,128,128,1) 100%)
                  - height: |
                      [[[
                        return window.innerWidth <= 600 ? '377px' : '448px';
                      ]]]
                  - border: 2px rgba(32,32,32,0.5) inset
                  - border-radius: 5px
                  - pointer-events: none
                name:
                  - font-size: 0.8em
                  - font-weight: bold
                  - color: gray
                  - text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.9)
                  - align-self: flex-start
                  - justify-self: start
                  - padding-left: 3%
                  - margin-top: '-3px'
                custom_fields:
                  jauge_air:
                    - position: absolute
                    - left: 38%
                    - top: 1.5%
                    - width: 60%
                  jauge_pm10:
                    - position: absolute
                    - left: 1%
                    - top: 13%
                  jauge_pm25:
                    - position: absolute
                    - left: 1%
                    - top: 30%
                  jauge_no2:
                    - position: absolute
                    - left: 1%
                    - top: 46%
                  jauge_o3:
                    - position: absolute
                    - left: 1%
                    - top: 62%
                  jauge_so2:
                    - position: absolute
                    - left: 1%
                    - top: 79%
          indice_pollens:
            card:
              type: custom:button-card
              name: Pollens
              custom_fields:
                jauge_pollens:
                  card:
                    type: custom:button-card
                    template: atmo_template
                    variables:
                      sensor_niveau: |
                        [[[
                          const jour = states['input_select.maison_selection_jour_atmo_france']?.state;
                          const base = 'sensor.qualite_globale_pollen_lyon';
                          return jour === 'tomorrow' ? base + '_j_1' : base;
                        ]]]
                      sensor_concentration: none
                      nom_legende: ''
                      icone: none
                      afficher_icone: false
                      afficher_legende: false
                      afficher_concentration: false
                jauge_aulne:
                  card:
                    type: custom:button-card
                    template: atmo_template
                    variables:
                      sensor_niveau: |
                        [[[
                          const jour = states['input_select.maison_selection_jour_atmo_france']?.state;
                          const base = 'sensor.niveau_aulne_lyon';
                          return jour === 'tomorrow' ? base + '_j_1' : base;
                        ]]]
                      sensor_concentration: |
                        [[[
                          const jour = states['input_select.maison_selection_jour_atmo_france']?.state;
                          const base = 'sensor.concentration_aulne_lyon';
                          return jour === 'tomorrow' ? base + '_j_1' : base;
                        ]]]
                      nom_legende: Pollen d'aulne
                      icone: mdi:tree
                      afficher_icone: true
                      afficher_legende: true
                      afficher_concentration: true
                jauge_ambroisie:
                  card:
                    type: custom:button-card
                    template: atmo_template
                    variables:
                      sensor_niveau: |
                        [[[
                          const jour = states['input_select.maison_selection_jour_atmo_france']?.state;
                          const base = 'sensor.niveau_ambroisie_lyon';
                          return jour === 'tomorrow' ? base + '_j_1' : base;
                        ]]]
                      sensor_concentration: |
                        [[[
                          const jour = states['input_select.maison_selection_jour_atmo_france']?.state;
                          const base = 'sensor.concentration_ambroisie_lyon';
                          return jour === 'tomorrow' ? base + '_j_1' : base;
                        ]]]
                      nom_legende: Pollen d'ambroisie
                      icone: mdi:sprout
                      afficher_icone: true
                      afficher_legende: true
                      afficher_concentration: true
                jauge_armoise:
                  card:
                    type: custom:button-card
                    template: atmo_template
                    variables:
                      sensor_niveau: |
                        [[[
                          const jour = states['input_select.maison_selection_jour_atmo_france']?.state;
                          const base = 'sensor.niveau_armoise_lyon';
                          return jour === 'tomorrow' ? base + '_j_1' : base;
                        ]]]
                      sensor_concentration: |
                        [[[
                          const jour = states['input_select.maison_selection_jour_atmo_france']?.state;
                          const base = 'sensor.concentration_armoise_lyon';
                          return jour === 'tomorrow' ? base + '_j_1' : base;
                        ]]]
                      nom_legende: Pollen d'armoise
                      icone: mdi:sprout
                      afficher_icone: true
                      afficher_legende: true
                      afficher_concentration: true
                jauge_bouleau:
                  card:
                    type: custom:button-card
                    template: atmo_template
                    variables:
                      sensor_niveau: |
                        [[[
                          const jour = states['input_select.maison_selection_jour_atmo_france']?.state;
                          const base = 'sensor.niveau_bouleau_lyon';
                          return jour === 'tomorrow' ? base + '_j_1' : base;
                        ]]]
                      sensor_concentration: |
                        [[[
                          const jour = states['input_select.maison_selection_jour_atmo_france']?.state;
                          const base = 'sensor.concentration_bouleau_lyon';
                          return jour === 'tomorrow' ? base + '_j_1' : base;
                        ]]]
                      nom_legende: Pollen de bouleau
                      icone: mdi:tree
                      afficher_icone: true
                      afficher_legende: true
                      afficher_concentration: true
                jauge_graminees:
                  card:
                    type: custom:button-card
                    template: atmo_template
                    variables:
                      sensor_niveau: |
                        [[[
                          const jour = states['input_select.maison_selection_jour_atmo_france']?.state;
                          const base = 'sensor.niveau_gramine_lyon';
                          return jour === 'tomorrow' ? base + '_j_1' : base;
                        ]]]
                      sensor_concentration: |
                        [[[
                          const jour = states['input_select.maison_selection_jour_atmo_france']?.state;
                          const base = 'sensor.concentration_gramine_lyon';
                          return jour === 'tomorrow' ? base + '_j_1' : base;
                        ]]]
                      nom_legende: Pollen de graminées
                      icone: mdi:grass
                      afficher_icone: true
                      afficher_legende: true
                      afficher_concentration: true
                jauge_olivier:
                  card:
                    type: custom:button-card
                    template: atmo_template
                    variables:
                      sensor_niveau: |
                        [[[
                          const jour = states['input_select.maison_selection_jour_atmo_france']?.state;
                          const base = 'sensor.niveau_olivier_lyon';
                          return jour === 'tomorrow' ? base + '_j_1' : base;
                        ]]]
                      sensor_concentration: |
                        [[[
                          const jour = states['input_select.maison_selection_jour_atmo_france']?.state;
                          const base = 'sensor.concentration_olivier_lyon';
                          return jour === 'tomorrow' ? base + '_j_1' : base;
                        ]]]
                      nom_legende: Pollen d'olivier
                      icone: mdi:tree
                      afficher_icone: true
                      afficher_legende: true
                      afficher_concentration: true
              styles:
                card:
                  - background: >
                      linear-gradient(135deg, rgba(64,64,64,1) 0%,
                      rgba(96,96,96,1) 25%, rgba(128,128,128,1) 100%)
                  - height: |
                      [[[
                        return window.innerWidth <= 600 ? '377px' : '448px';
                      ]]]
                  - border: 2px rgba(32,32,32,0.5) inset
                  - border-radius: 5px
                  - pointer-events: none
                name:
                  - font-size: 0.8em
                  - font-weight: bold
                  - color: gray
                  - text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.9)
                  - align-self: flex-start
                  - justify-self: start
                  - padding-left: 3%
                  - margin-top: 1px
                custom_fields:
                  jauge_pollens:
                    - position: absolute
                    - left: 38%
                    - top: 1.5%
                    - width: 60%
                  jauge_aulne:
                    - position: absolute
                    - left: 1%
                    - top: 10%
                  jauge_ambroisie:
                    - position: absolute
                    - left: 1%
                    - top: 25%
                  jauge_armoise:
                    - position: absolute
                    - left: 1%
                    - top: 40%
                  jauge_bouleau:
                    - position: absolute
                    - left: 1%
                    - top: 55%
                  jauge_graminees:
                    - position: absolute
                    - left: 1%
                    - top: 69%
                  jauge_olivier:
                    - position: absolute
                    - left: 1%
                    - top: 83%
        styles:
          card:
            - aspect-ratio: |
                [[[
                  return window.innerWidth <= 600 ? '1/1.1' : '1/1';
                ]]]
            - background: >
                linear-gradient(135deg, rgba(64,64,64,1) 0%, rgba(96,96,96,1)
                25%, rgba(128,128,128,1) 100%)
            - border-radius: 10px
            - box-shadow: 4px 4px 8px rgba(32,32,32,0.5)
            - border: 1px rgba(32,32,32,0.5) outset
            - pointer-events: none
          name:
            - font-size: |
                [[[
                  return window.innerWidth <= 600 ? '0.8em' : '1.1em';
                ]]]
            - font-weight: bold
            - color: lightgray
            - text-shadow: 2px 2px 2px rgba(0, 0, 0, 0.9)
            - align-self: flex-start
            - justify-self: start
            - padding-left: 3%
            - margin-top: |
                [[[
                  return window.innerWidth <= 600 ? '-10px' : '-15px';
                ]]]
          custom_fields:
            previous:
              - position: absolute
              - top: 0.7%
              - right: |
                  [[[
                    return window.innerWidth <= 600 ? '170px' : '174px';
                  ]]]
            day:
              - position: absolute
              - top: 0.7%
              - right: |
                  [[[
                    return window.innerWidth <= 600 ? '124px' : '126px';
                  ]]]
            next:
              - position: absolute
              - top: 0.7%
              - right: |
                  [[[
                    return window.innerWidth <= 600 ? '100px' : '96px';
                  ]]]
            indice_air:
              - position: absolute
              - top: 7%
              - left: 2%
              - width: 47%
            indice_pollens:
              - position: absolute
              - top: 7%
              - right: 2%
              - width: 47%

Tu sais il y a les couleurs dans les attributs des entités atmo france.

10 lignes de code en moins :wink:

    - background-color: '[[[return entity.attributes.Couleur]]]'

Pareil pour l’état.

Oui, mais j’utilise la même couleur en fond avec une transparence à 0.3. Il faudrait que je modifie la couleur HTML (le code Hexadécimal) de l’attribut pour y appliquer la transparence.

Avec les templates, je vais à minima diviser le nombre de lignes par 10.

Je vais ajouter un bouton pour avoir un affichage sous forme de jauge ou un affichage sous forme d’« objets » comme toi (j’ai de la place en haut en face de « Données atmosphériques » et deux triangles (un vers la gauche et un vers la droite) pour afficher les données du jour et les données de J+1.

Je reposterai le code complet avec les templates et les modifications.

1 « J'aime »

Ah ouai pas mal, c’est un beau rendu.
Bon je vais essayer tout ça, merci à vous :wink:

Bonjour,

J’ai utilisé ton code freetronic, merci encore !
Il est actuellement comme cela :

type: custom:bubble-card
card_type: button
entity: media_player.salon
show_icon: true
icon: mdi:bed
hash: "#menu"
card_layout: normal
width_desktop: 400px
sub_button:
  - icon: mdi:speaker-multiple
    show_state: false
    show_background: true
    show_attribute: false
    show_name: null
    tap_action:
      action: navigate
      navigation_path: "#entree"
  - icon: mdi:lightbulb-on
    show_state: false
    show_background: true
    show_attribute: false
    show_name: null
    tap_action:
      action: navigate
      navigation_path: "#cagibi"
  - icon: mdi:window-shutter
    show_state: false
    show_background: true
    show_attribute: false
    show_name: null
    tap_action:
      action: navigate
      navigation_path: "#cuisine"
styles: |
  .bubble-button-card-container {
    box-shadow: none;
    border-radius: 15px !important;  # Ajustez la valeur ici pour l'arrondi de la carte
  }
  .bubble-sub-button-container {
    width: 100% !important;  # Étend la largeur sur toute la carte
    display: flex !important;
    justify-content: left !important;  # Centre les sous-boutons horizontalement
    align-items: center !important;  # Aligne les boutons verticalement
  }
  .bubble-name-container {
    margin-right: 200px !important;
  }
  .bubble-sub-button:active {
    background-color: rgba(0, 123, 255, 0.5); /* Couleur bleue semi-transparente */
  }
close_on_click: true
name: Menu
show_name: false

Visuellement cela donne :

Capture d’écran 2025-04-15 à 08.28.01

La bubble card pointe vers une entité, j’aimerai pointer dans une la vue de la piece, je sais pas si on peut le faire, j’ai modifier les lignes de code toute la soirée mais j’ai pas réussi… #le code pour les nuls

Si il y a une idée je suis preneur :slight_smile:
Merci.

Re,

si c’est pour le « bouton » il faut ajouter ça

          button_action:
            tap_action:
              action: navigate
              navigation_path: '#alarme'

le path c’est ce qu’on veut, un bubble popup, un dashboard …

ici c’est en picture element mais c’est pareil

1

cdt

Merci à toi je check tout ca.

1 « J'aime »

Bon je seche, voici le code que j’essai de rentrer, je dis bien j’essai car impossible de l’enregistrer.

type: custom:bubble-card
card_type: button
button_type: name
name: chambre
icon: mdi:sofa
tap_action:
  action: navigate
  navigation_path: "#PIECE"
hash: "#menu"
card_layout: normal
width_desktop: 400px
sub_button:
  - icon: mdi:speaker-multiple
    show_state: false
    show_background: true
    show_attribute: false
    show_name: null
    tap_action:
      action: navigate
      navigation_path: "#entree"
styles: |
  .bubble-button-card-container {
    box-shadow: none;
    border-radius: 15px !important;  # Ajustez la valeur ici pour l'arrondi de la carte
  }
  .bubble-sub-button-container {
    width: 100% !important;  # Étend la largeur sur toute la carte
    display: flex !important;
    justify-content: left !important;  # Centre les sous-boutons horizontalement
    align-items: center !important;  # Aligne les boutons verticalement
  }
  .bubble-name-container {
    margin-right: 200px !important;
  }
  .bubble-sub-button:active {
    background-color: rgba(0, 123, 255, 0.5); /* Couleur bleue semi-transparente */
  }
close_on_click: true
name: Menu
show_name: false
button_type: name

j’essai simplement d’y integrer le nom de la piece et lorsque je clique sur son icone il pointe dans la vue.

Autre question, à quoi correspond les lignes name, show et button type en fin de lignes ? c’est pour essayer de comprendre l’architecture à donner.

Merci.

C’est quand on fait un copier coller depuis un mobile .
J’ai déjà eu le cas… c’est pénible :roll_eyes: contournable en collant d’abord dans une application de texte puis en copiant ceci et en collant ensuite sur le forum.
Je ne sais pas pourquoi ça fait ça.
Je suis sous iOS.

Donc les 4 lignes à partir de CLOSE, je peux delete ?

tu as deux fois name: et button_type.

Oui, les 4 lignes de fin je viens de les supprimer.
Par contre il me dit que je dois préciser une entité, moi je veux juste que ca m’ouvre la vue que je choisi.
Je mets navigate, et navigate path : nom de ma vue.

Re,

Oui bubble n’aime pas trop les doublons ( comme les autres cartes sans doute )

tu ne peux rien casser en supprimant les 4 dernières lignes, au pire certains trucs s’afficheront, ça effacera des doublon et ça supprimera le close pour un bubble popup ( j’avais prévenu il y avait du ménage à faire) :wink:

cdt

une entité est obligatoire. Mais comme tu vas utiliser un tap_action, l’entité ne servira pas, mais est obligatoire.

1 « J'aime »

après ça, ça « fonctionne » sans entité

  - type: custom:bubble-card
    style:
      left: 50%
      top: 50%
      width: 8.5%
      height: 5%
      z-index: 10
    card_type: button
    button_type: name
    icon: mdi:monitor-dashboard
    name: Menu
    button_action:
      tap_action:
        action: navigate
        navigation_path: "#menu"
    styles: |-
      .bubble-button-card-container {
        box-shadow: none;
        border-radius: 15px !important;
      }
    scrolling_effect: false

mais ça fait un message d’erreur, donc au choix

1

cdt