Régler l'alignement des cartes

Mon problème

Bonjour,

je demande votre aide, j’ai déjà passé quelques heures à chercher sans trouver de solution.

Je souhaite placer les cartes dans un dashboard de la manière suivante :
[            ] [            ] [            ]
[Carte 1] [Carte 2] [Carte 3]
[            ] [            ] [            ]

[                           ] [            ]
[       Carte 4        ] [Carte 5]
[                           ] [            ]

Objectifs :

  • cartes 1, 2, 3 et 5 de même taille (hauteur et largeur)
  • toutes les cartes ont la même hauteur
  • carte 4 est positionnée en dessous des cartes 1 et 2 (en HTML je ferais celà avec un colspan)

Attention : je ne peux pas utiliser layout-card (ca marche avec layout card) parce que ce module fait planter Home Assistant sur mon iPad Air.

Voici ce que ca donne pour le moment : j’arrive uniquement à ce que les cartes 4 et 5 soient de meme largeur…
J’ai testé avec une carte de type grid, des empilements de horizontal et vertical stack… je sèche

Merci par avance pour vos avis sur la manière de procéder, je dois mal m’y prendre forcément !

Ci dessous, le pavé avec les 5 bouttons et les deux « Tempo » devraient etre alignés en dessous de cuisinet et entrée

Code de la vue :

type: vertical-stack
cards:
  - type: horizontal-stack
    cards:
      - show_name: true
        show_icon: true
        type: custom:card-templater
        card:
          type: entities
          title_template: Cuisine {{ states("sensor.cuisine_temperature") }} °C
          entities:
            - entity: climate.smart_thermostat_2208025128393260120148e1e99cd769
              type: custom:climate-mode-entity-row
              name_template: Mode
              modes:
                - preset_mode: auto
                  icon: mdi:thermometer-auto
                  color: var(--state-climate-auto-color)
                - preset_mode: comfort
                  icon: mdi:white-balance-sunny
                  color: var(--state-climate-heat-color)
                - preset_mode: sleep
                  icon: mdi:moon-waning-crescent
                  color: '#FFFF66'
                - preset_mode: away
                  icon: mdi:home-export-outline
                  color: '#0000FF'
                - hvac_mode: 'off'
                  icon: mdi:power
                  color: white
            - entity: sensor.cuisine_consigne
              name_template: Consigne
            - entity: sensor.cuisine_mode_chauffage
              name_template: Etat
        view_layout:
          grid-area: cuisine
        entities:
          - sensor.cuisine_temperature
          - climate.smart_thermostat_2208025128393260120148e1e99cd769
          - sensor.cuisine_consigne
          - sensor.cuisine_mode_chauffage
      - show_name: true
        show_icon: true
        type: custom:card-templater
        card:
          type: entities
          title_template: Entrée {{ states("sensor.entree_temperature") }} °C
          entities:
            - entity: climate.smart_thermostat_2208026529755660120148e1e99cd166
              type: custom:climate-mode-entity-row
              name_template: Mode
              modes:
                - preset_mode: auto
                  icon: mdi:thermometer-auto
                  color: var(--state-climate-auto-color)
                - preset_mode: comfort
                  icon: mdi:white-balance-sunny
                  color: var(--state-climate-heat-color)
                - preset_mode: sleep
                  icon: mdi:moon-waning-crescent
                  color: '#FFFF66'
                - preset_mode: away
                  icon: mdi:home-export-outline
                  color: '#0000FF'
                - hvac_mode: 'off'
                  icon: mdi:power
                  color: white
            - entity: sensor.entree_consigne
              name_template: Consigne
            - entity: sensor.entree_mode_chauffage
              name_template: Etat
        view_layout:
          grid-area: entree
        entities:
          - sensor.entree_temperature
          - climate.smart_thermostat_2208026529755660120148e1e99cd166
          - sensor.entree_consigne
          - sensor.entree_mode_chauffage
      - show_name: true
        show_icon: true
        type: custom:card-templater
        card:
          type: entities
          title_template: Salle à manger {{ states("sensor.salle_a_manger_temperature") }} °C
          entities:
            - entity: climate.smart_thermostat_2208023308719660120148e1e99cd4fe
              type: custom:climate-mode-entity-row
              name_template: Mode
              modes:
                - preset_mode: auto
                  icon: mdi:thermometer-auto
                  color: var(--state-climate-auto-color)
                - preset_mode: comfort
                  icon: mdi:white-balance-sunny
                  color: var(--state-climate-heat-color)
                - preset_mode: sleep
                  icon: mdi:moon-waning-crescent
                  color: '#FFFF66'
                - preset_mode: away
                  icon: mdi:home-export-outline
                  color: '#0000FF'
                - hvac_mode: 'off'
                  icon: mdi:power
                  color: white
            - entity: sensor.salle_a_manger_consigne
              name_template: Consigne
            - entity: sensor.salle_a_manger_mode_chauffage
              name_template: Etat
        view_layout:
          grid-area: sam
        entities:
          - sensor.salle_a_manger_temperature
          - climate.smart_thermostat_2208023308719660120148e1e99cd4fe
          - sensor.salle_a_manger_consigne
          - sensor.salle_a_manger_mode_chauffage
  - type: horizontal-stack
    cards:
      - type: vertical-stack
        style: |
          ha-card
            {
              width: 200px
            }
        cards:
          - type: horizontal-stack
            cards:
              - show_name: true
                show_icon: true
                type: button
                entity: scene.chauffage_au_sol_mode_auto
                name: Auto
                tap_action:
                  action: call-service
                  service: scene.turn_on
                  service_data:
                    entity_id: scene.chauffage_au_sol_mode_auto
                icon: mdi:thermometer-auto
                icon_height: 50px
                show_state: false
                card_mod: null
                style: |
                  ha-card {
                      {% if is_state_attr('climate.smart_thermostat_2208025128393260120148e1e99cd769', 'preset_mode', 'auto') 
                        and is_state_attr('climate.smart_thermostat_2208026529755660120148e1e99cd166', 'preset_mode', 'auto') 
                        and is_state_attr('climate.smart_thermostat_2208023308719660120148e1e99cd4fe', 'preset_mode', 'auto') 
                        and is_state_attr('climate.smart_thermostat_2208028530181360120148e1e99cd4e1', 'preset_mode', 'auto') 
                      %}
                      background: var(--state-climate-auto-color);
                      color:white;
                      {% endif %}
                  }
              - show_name: true
                show_icon: true
                type: button
                entity: scene.chauffage_au_sol_mode_confort
                name: Confort
                tap_action:
                  action: call-service
                  service: scene.turn_on
                  data: {}
                  target:
                    entity_id: scene.chauffage_au_sol_mode_confort
                icon: mdi:white-balance-sunny
                icon_height: 50px
                show_state: false
                card_mod: null
                style: |
                  ha-card {
                      {% if is_state_attr('climate.smart_thermostat_2208025128393260120148e1e99cd769', 'preset_mode', 'comfort') 
                        and is_state_attr('climate.smart_thermostat_2208026529755660120148e1e99cd166', 'preset_mode', 'comfort') 
                        and is_state_attr('climate.smart_thermostat_2208023308719660120148e1e99cd4fe', 'preset_mode', 'comfort') 
                        and is_state_attr('climate.smart_thermostat_2208028530181360120148e1e99cd4e1', 'preset_mode', 'comfort') 
                      %}
                      background: var(--state-climate-heat-color);
                      color:white;
                      {% endif %}
                  }
              - show_name: true
                show_icon: true
                type: button
                entity: scene.chauffage_au_sol_mode_nuit
                name: Nuit
                tap_action:
                  action: call-service
                  service: scene.turn_on
                  data: {}
                  target:
                    entity_id: scene.chauffage_au_sol_mode_nuit
                icon: mdi:moon-waning-crescent
                icon_height: 50px
                show_state: false
                card_mod: null
                style: |
                  ha-card {
                      {% if is_state_attr('climate.smart_thermostat_2208025128393260120148e1e99cd769', 'preset_mode', 'sleep') 
                        and is_state_attr('climate.smart_thermostat_2208026529755660120148e1e99cd166', 'preset_mode', 'sleep') 
                        and is_state_attr('climate.smart_thermostat_2208023308719660120148e1e99cd4fe', 'preset_mode', 'sleep') 
                        and is_state_attr('climate.smart_thermostat_2208028530181360120148e1e99cd4e1', 'preset_mode', 'sleep') 
                      %}
                      background: #FFFF66;
                      color:black;
                      {% endif %}
                  }
              - show_name: true
                show_icon: true
                type: button
                entity: scene.thermostats_en_mode_eco
                name: Absent
                tap_action:
                  action: call-service
                  service: scene.turn_on
                  data: {}
                  target:
                    entity_id: scene.thermostats_en_mode_eco
                icon: mdi:home-export-outline
                icon_height: 50px
                show_state: false
                card_mod: null
                style: |
                  ha-card {
                      {% if is_state_attr('climate.smart_thermostat_2208025128393260120148e1e99cd769', 'preset_mode', 'away') 
                        and is_state_attr('climate.smart_thermostat_2208026529755660120148e1e99cd166', 'preset_mode', 'away') 
                        and is_state_attr('climate.smart_thermostat_2208023308719660120148e1e99cd4fe', 'preset_mode', 'away') 
                        and is_state_attr('climate.smart_thermostat_2208028530181360120148e1e99cd4e1', 'preset_mode', 'away') 
                      %}
                      background: var(--state-climate-heat-color);
                      color:white;
                      {% endif %}
                  }
              - show_name: true
                show_icon: true
                type: button
                entity: scene.chauffage_au_sol_mode_off
                tap_action:
                  action: call-service
                  service: scene.turn_on
                  data: {}
                  target:
                    entity_id: scene.chauffage_au_sol_mode_off
                icon: mdi:power
                icon_height: 50px
                show_state: false
                name: 'Off'
                card_mod: null
                style: |
                  ha-card {
                      {% if is_state_attr('climate.smart_thermostat_2208025128393260120148e1e99cd769', 'preset_mode', 'off') 
                        and is_state_attr('climate.smart_thermostat_2208026529755660120148e1e99cd166', 'preset_mode', 'off') 
                        and is_state_attr('climate.smart_thermostat_2208023308719660120148e1e99cd4fe', 'preset_mode', 'off') 
                        and is_state_attr('climate.smart_thermostat_2208028530181360120148e1e99cd4e1', 'preset_mode', 'off') 
                      %}
                      background: var(--label-badge-grey);
                      color:white;
                      {% endif %}
                  }
          - type: horizontal-stack
            cards:
              - type: entities
                title: Tempo actuel
                entities:
                  - entity: binary_sensor.rte_tempo_heures_creuses
                    name: Heures creuses
                    icon: none
                state_color: false
                show_header_toggle: true
                card_mod: null
                style: |
                  ha-card {
                      color: black;
                      {% if is_state('sensor.rte_tempo_couleur_actuelle', 'Bleu') %}
                      background: blue;
                      color:white
                      {% elif is_state('sensor.rte_tempo_couleur_actuelle', 'Rouge') %}
                      background: red;
                      color:white
                      {% else %}
                      background: white;
                      color:black
                      {% endif %}
                  }
              - type: entities
                title: Tempo à venir
                entities:
                  - entity: sensor.rte_tempo_prochaine_couleur_changement
                    icon: none
                    name: 'Changement prévu '
                card_mod: null
                style: |
                  ha-card {
                      color: black;
                      {% if is_state('sensor.rte_tempo_couleur_actuelle', 'Bleu') %}
                      background: blue;
                      color:white
                      {% elif is_state('sensor.rte_tempo_couleur_actuelle', 'Rouge') %}
                      background: red;
                      color:white
                      {% else %}
                      background: white;
                      color:black
                      {% endif %}
                  }
      - show_name: true
        show_icon: true
        type: custom:card-templater
        style: |
          ha-card
            {
              width: 100px
            }
        card:
          type: entities
          title_template: Salon {{ states("sensor.salon_temperature") }} °C
          entities:
            - entity: climate.smart_thermostat_2208028530181360120148e1e99cd4e1
              type: custom:climate-mode-entity-row
              name_template: Mode
              modes:
                - preset_mode: auto
                  icon: mdi:thermometer-auto
                  color: var(--state-climate-auto-color)
                - preset_mode: comfort
                  icon: mdi:white-balance-sunny
                  color: var(--state-climate-heat-color)
                - preset_mode: sleep
                  icon: mdi:moon-waning-crescent
                  color: '#FFFF66'
                - preset_mode: away
                  icon: mdi:home-export-outline
                  color: '#0000FF'
                - hvac_mode: 'off'
                  icon: mdi:power
                  color: white
            - entity: sensor.salon_consigne
              name_template: Consigne
            - entity: sensor.salon_mode_chauffage
              name_template: Etat
        entities:
          - sensor.salon_temperature
          - climate.smart_thermostat_2208028530181360120148e1e99cd4e1
          - sensor.salon_consigne
          - sensor.salon_mode_chauffage

Ma configuration


[center]

System Information

version core-2023.9.3
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.11.5
os_name Linux
os_version 6.1.45
arch x86_64
timezone Europe/Paris
config_dir /config
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
GitHub API Calls Remaining 5000
Installed Version 1.32.1
Stage running
Available Repositories 1301
Downloaded Repositories 8
Home Assistant Cloud
logged_in false
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Home Assistant Supervisor
host_os Home Assistant OS 10.5
update_channel stable
supervisor_version supervisor-2023.09.2
agent_version 1.5.1
docker_version 23.0.6
disk_total 30.8 GB
disk_used 5.2 GB
healthy true
supported true
board ova
supervisor_api ok
version_api ok
installed_addons Terminal & SSH (9.7.1), Studio Code Server (5.11.0)
Dashboards
dashboards 2
resources 3
views 5
mode storage
Recorder
oldest_recorder_run 24 septembre 2023 à 19:21
current_recorder_run 4 octobre 2023 à 07:41
estimated_db_size 241.81 MiB
database_engine sqlite
database_version 3.41.2
[/center] ___

Salut,

Perso j’utilise layout pour ce genre de chose, mais si ça ne marche pas chez toi alors pas d’idée à part virer l’ipad :wink:

1 « J'aime »

Je te conseil de passer par custom:grid-layout,

ce qui te permettra de faire le layout que tu veut exactement mais surtout d’avoir un layout adapter chaque résolution d’écran différentes ( tu peut par exemple placer differents les éléments sur un smartphone, tablette, écran d’ordi et écran d’ordi 4k)

type: custom:layout-card
layout_type: custom:grid-layout

Bonjour,

Faut tout lire avant de répondre :wink:

1 « J'aime »