Nouvelle intégration Vigieau

Ho non. Moi qui découvre ha. Le sensor est en inconnu.

Vais attendre lupdate

Bonjour

A t on des nouvelles sur Vigieau ? Cela ne marche toujours pas chez moi.

Salut

Le problème est réglé depuis la version 0.5.0.
As-tu mis à jour Vigieau ?

Ma version est en 0.1.0 mais l’application m’apparait comme a jour.
J’ai essayé de la désinstaller puis de la réinstaller. Meme version…

La version actuelle est 0.5.2.
Dans HACS, tu dois avoir ça :
image

1 « J'aime »

J’ai réussi à trouver. Je réinstallais l’intégration par HA et non pas HACS donc la version était toujours la même.

1 « J'aime »

Bonjour @kamaradclimber ,
merci pour la dernière maj 0.7.6, avec l’ajout du sensor numérique pour les alertes. Très pratique pour l’utiliser dans un bar-card.
image

2 « J'aime »

Bonjour est ce que l’intégration fonctionne chez vous ?, depuis aujourd’hui j’ai que des « unknown » partout.

Hello, pareil ici. Ca doit être temporaire.

Quoique =>

1 « J'aime »

Merci pour l’info j ai été sur le site de vigieau (https://vigieau.gouv.fr/) pour voir si cela fonctionnait mais pas sur celui de l’API

J’ai laissé un message sur github

Même problème de mon coté, tout est en inconnu

Bonsoir,

Merci du message, je jetterai un coup d’œil ce weekend si possible.

2 « J'aime »

L’intégration viens d’être mise à jour

1 « J'aime »

Super, ça fonctionne à nouveau

Bon boulot, merci @kamaradclimber :wink:

1 « J'aime »

Salut,
Merci pour cette intégration.
Si ça peut intérresser du monde, j’ai fait une card bubble-card (je n’ai pas besoin de toutes les alertes, je n’ai mis que celles qui m’interressent !):
image

Dont voici le code:

type: custom:bubble-card
card_type: button
button_type: state
entity: sensor.alert_level_in_frouzins
name: Vigieau Frouzins
show_state: true
show_attribute: true
scrolling_effect: false
tap_action:
  action: navigate
  navigation_path: "#vigieau"
double_tap_action:
  action: none
hold_action:
  action: none
button_action:
  tap_action:
    action: none
  double_tap_action:
    action: none
  hold_action:
    action: none
card_layout: large
styles: |
  .bubble-button-card-container {
    background: ${ 
      hass.states['sensor.alert_level_in_frouzins']?.state === 'vigilance (pas de restriction)'
      ? 'rgba(var(--rgb-secondary-text-color), 0.2)'
      : hass.states['sensor.alert_level_in_frouzins']?.state === 'Crise'
      ? 'rgba(255, 0, 0, 0.2)'
      : hass.states['sensor.alert_level_in_frouzins']?.state === 'Alerte renforcée'
      ? 'rgba(255, 165, 0, 0.2)'
      : hass.states['sensor.alert_level_in_frouzins']?.state === 'Alerte'
      ? 'rgba(255, 255, 0, 0.2)'
      : 'rgba(0, 128, 0, 0.2)'
    } !important;
  }
  .bubble-button-card-container .bubble-icon {
    color: ${ 
      hass.states['sensor.alert_level_in_frouzins']?.state === 'vigilance (pas de restriction)'
      ? 'rgb(135, 182, 209)'
      : hass.states['sensor.alert_level_in_frouzins']?.state === 'Crise'
      ? 'rgb(255, 0, 0)'
      : hass.states['sensor.alert_level_in_frouzins']?.state === 'Alerte renforcée'
      ? 'rgb(255, 165, 0)'
      : hass.states['sensor.alert_level_in_frouzins']?.state === 'Alerte'
      ? 'rgb(255, 255, 0)'
      : 'rgb(0, 128, 0)'
    } !important;
    background-color: ${ 
      hass.states['sensor.alert_level_in_frouzins']?.state === 'vigilance (pas de restriction)'
      ? 'rgba(76, 124, 30, 0.2)'
      : hass.states['sensor.alert_level_in_frouzins']?.state === 'Crise'
      ? 'rgba(255, 0, 0, 0.2)'
      : hass.states['sensor.alert_level_in_frouzins']?.state === 'Alerte renforcée'
      ? 'rgba(255, 165, 0, 0.2)'
      : hass.states['sensor.alert_level_in_frouzins']?.state === 'Alerte'
      ? 'rgba(255, 255, 0, 0.2)'
      : 'rgba(0, 128, 0, 0.2)'
    } !important;
    border-radius: 50% !important;
    padding: 5px !important;
  }

  .bubble-sub-button-1 {
      background: ${ hass.states['sensor.arrosage_des_jardins_potagers_restrictions_frouzins']?.state === 'vigilance (pas de restriction)'
      ? 'rgba(247, 53, 67, 0.4)'
      : ''
      } !important;
      color: ${ 
          hass.states['sensor.arrosage_des_jardins_potagers_restrictions_frouzins']?.state === 'vigilance (pas de restriction)'
          ? ''
          : hass.states['sensor.arrosage_des_jardins_potagers_restrictions_frouzins']?.state === 'Crise'
          ? 'red'
          : hass.states['sensor.arrosage_des_jardins_potagers_restrictions_frouzins']?.state === 'Alerte renforcée'
          ? 'orange'
          : hass.states['sensor.arrosage_des_jardins_potagers_restrictions_frouzins']?.state === 'Alerte'
          ? 'yellow'
          : 'green'
      } !important;
  }

  .bubble-sub-button-2 {
      background: ${ hass.states['sensor.arrosage_des_pelouses_restrictions_frouzins']?.state === 'vigilance (pas de restriction)'
      ? 'rgba(247, 53, 67, 0.4)'
      : ''
      } !important;
      color: ${ 
          hass.states['sensor.arrosage_des_pelouses_restrictions_frouzins']?.state === 'vigilance (pas de restriction)'
          ? ''
          : hass.states['sensor.arrosage_des_pelouses_restrictions_frouzins']?.state === 'Crise'
          ? 'red'
          : hass.states['sensor.arrosage_des_pelouses_restrictions_frouzins']?.state === 'Alerte renforcée'
          ? 'orange'
          : hass.states['sensor.arrosage_des_pelouses_restrictions_frouzins']?.state === 'Alerte'
          ? 'yellow'
          : 'green'
      } !important;
  }

  .bubble-sub-button-3 {
      background: ${ hass.states['sensor.vidange_et_remplissage_des_piscines_restrictions_frouzins']?.state === 'vigilance (pas de restriction)'
      ? 'rgba(247, 53, 67, 0.4)'
      : ''
      } !important;
      color: ${ 
          hass.states['sensor.vidange_et_remplissage_des_piscines_restrictions_frouzins']?.state === 'vigilance (pas de restriction)'
          ? ''
          : hass.states['sensor.vidange_et_remplissage_des_piscines_restrictions_frouzins']?.state === 'Crise'
          ? 'red'
          : hass.states['sensor.vidange_et_remplissage_des_piscines_restrictions_frouzins']?.state === 'Alerte renforcée'
          ? 'orange'
          : hass.states['sensor.vidange_et_remplissage_des_piscines_restrictions_frouzins']?.state === 'Alerte'
          ? 'yellow'
          : 'green'
      } !important;
  }

  ${(() => {
      const alertlevel = hass.states['sensor.alert_level_in_frouzins']?.state; 
      let icon;

      // Conditions pour définir l'icône
      if (alertlevel === 'vigilance (pas de restriction)') {
        icon = 'mdi:water-check'; 
      } else if (alertlevel === 'Alerte') {
        icon = 'mdi:water-alert'; 
      } else if (alertlevel === 'Alerte renforcée') {
        icon = 'mdi:water-remove';
      } else if (alertlevel === 'Crise') {
        icon = 'mdi:water-off';
      }

      // Applique l'icône
      card.querySelector('.bubble-icon').setAttribute('icon', icon);

      let color;

      // Conditions pour définir la couleur
      if (alertlevel === 'vigilance (pas de restriction)') {
        color = 'green'; 
      } else if (alertlevel === 'Alerte') {
        color = 'yellow'; 
      } else if (alertlevel === 'Alerte renforcée') {
        color = 'orange';
      } else if (alertlevel === 'Crise') {
        color = 'red';
      }

      // Applique la couleur et rend le texte en gras
      card.querySelector('.bubble-state').style.color = color; // Applique la couleur
      card.querySelector('.bubble-state').style.fontWeight = 'bold'; // Texte en gras
      card.querySelector('.bubble-state').style.fontSize = '13px'; // Taille de police à 13 pixels
    })()
  } !important
sub_button:
  - entity: sensor.arrosage_des_jardins_potagers_restrictions_frouzins
  - entity: sensor.arrosage_des_pelouses_restrictions_frouzins
  - entity: sensor.vidange_et_remplissage_des_piscines_restrictions_frouzins
card_mod: null

Evidemment, il faut remplacer ‹ Frouzins › par votre commune !

3 « J'aime »

Hello,

Merci pour le partage, je voulais justement un truc dans le genre, je creuserai dès que j’aurai un moment :wink:

cdt

En piquant une partie du code de @BBE , je fait le pop-up suivant lors d’un click sur l’icone:

Code de la card:

type: vertical-stack
cards:
  - type: custom:bubble-card
    card_type: pop-up
    hash: "#vigieau"
    name: Vigieau
    show_header: false
    scrolling_effect: false
    force_icon: false
    show_state: false
    show_last_changed: false
    show_attribute: false
  - type: custom:bubble-card
    card_type: button
    button_type: state
    entity: sensor.alert_level_in_frouzins
    name: Vigieau Frouzins
    show_state: true
    show_attribute: true
    scrolling_effect: false
    tap_action:
      action: none
    double_tap_action:
      action: none
    hold_action:
      action: none
    button_action:
      tap_action:
        action: none
      double_tap_action: null
      action: none
      hold_action:
        action: none
    card_layout: large
    styles: |
      .bubble-button-card-container {
        background: ${ 
          hass.states['sensor.alert_level_in_frouzins']?.state === 'vigilance (pas de restriction)'
          ? 'rgba(var(--rgb-secondary-text-color), 0.2)'
          : hass.states['sensor.alert_level_in_frouzins']?.state === 'Crise'
          ? 'rgba(255, 0, 0, 0.2)'
          : hass.states['sensor.alert_level_in_frouzins']?.state === 'Alerte renforcée'
          ? 'rgba(255, 165, 0, 0.2)'
          : hass.states['sensor.alert_level_in_frouzins']?.state === 'Alerte'
          ? 'rgba(255, 255, 0, 0.2)'
          : 'rgba(0, 128, 0, 0.2)'
        } !important;
      }
      .bubble-button-card-container .bubble-icon {
        color: ${ 
          hass.states['sensor.alert_level_in_frouzins']?.state === 'vigilance (pas de restriction)'
          ? 'rgb(135, 182, 209)'
          : hass.states['sensor.alert_level_in_frouzins']?.state === 'Crise'
          ? 'rgb(255, 0, 0)'
          : hass.states['sensor.alert_level_in_frouzins']?.state === 'Alerte renforcée'
          ? 'rgb(255, 165, 0)'
          : hass.states['sensor.alert_level_in_frouzins']?.state === 'Alerte'
          ? 'rgb(255, 255, 0)'
          : 'rgb(0, 128, 0)'
        } !important;
        background-color: ${ 
          hass.states['sensor.alert_level_in_frouzins']?.state === 'vigilance (pas de restriction)'
          ? 'rgba(76, 124, 30, 0.2)'
          : hass.states['sensor.alert_level_in_frouzins']?.state === 'Crise'
          ? 'rgba(255, 0, 0, 0.2)'
          : hass.states['sensor.alert_level_in_frouzins']?.state === 'Alerte renforcée'
          ? 'rgba(255, 165, 0, 0.2)'
          : hass.states['sensor.alert_level_in_frouzins']?.state === 'Alerte'
          ? 'rgba(255, 255, 0, 0.2)'
          : 'rgba(0, 128, 0, 0.2)'
        } !important;
        border-radius: 50% !important;
        padding: 5px !important;
      }

      ${(() => {
          const alertlevel = hass.states['sensor.alert_level_in_frouzins']?.state; 
          let icon;

          // Conditions pour définir l'icône
          if (alertlevel === 'vigilance (pas de restriction)') {
            icon = 'mdi:water-check'; 
          } else if (alertlevel === 'Alerte') {
            icon = 'mdi:water-alert'; 
          } else if (alertlevel === 'Alerte renforcée') {
            icon = 'mdi:water-remove';
          } else if (alertlevel === 'Crise') {
            icon = 'mdi:water-off';
          }

          // Applique l'icône
          card.querySelector('.bubble-icon').setAttribute('icon', icon);

          let color;

          // Conditions pour définir la couleur
          if (alertlevel === 'vigilance (pas de restriction)') {
            color = 'green'; 
          } else if (alertlevel === 'Alerte') {
            color = 'yellow'; 
          } else if (alertlevel === 'Alerte renforcée') {
            color = 'orange';
          } else if (alertlevel === 'Crise') {
            color = 'red';
          }

          // Applique la couleur et rend le texte en gras
          card.querySelector('.bubble-state').style.color = color; // Applique la couleur
          card.querySelector('.bubble-state').style.fontWeight = 'bold'; // Texte en gras
          card.querySelector('.bubble-state').style.fontSize = '13px'; // Taille de police à 13 pixels
        })()
      } !important
  - type: custom:bubble-card
    card_type: separator
  - type: custom:auto-entities
    card:
      type: custom:vertical-stack-in-card
    card_param: cards
    filter:
      include:
        - entity_id: sensor.*_restrictions_frouzins
          options:
            type: custom:mushroom-template-card
            primary: "{{ state_attr(entity,'friendly_name')}}"
            secondary: "{{states(entity)}}"
            icon: "{{ state_attr(entity,'icon')}}"
            icon_color: |-
              {% if is_state(entity, 'Interdiction') %} 
                red
              {% elif is_state(entity, 'Interdiction sur plage horaire') %} 
                orange
              {% elif is_state(entity, 'Interdiction sauf exception') %} 
                orange
              {% elif is_state(entity, 'Aucune restriction') %} 
                green
              {% else %}
                grey
              {% endif %}
            layout: horizontal
            tap_action:
              action: more-info
            hold_action:
              action: more-info
            double_tap_action:
              action: more-info

Il faut créer une seconde card sur la même page que la première. Cette carte est invisible et n’apparait que lors d’un clic sur l’icone de la carte précédente :
image

Pour un clic plus permissif, il suffit de mettre le code suivant à la place des actions sur la première card:

tap_action:
  action: navigate
  navigation_path: "#vigieau"
double_tap_action:
  action: none
hold_action:
  action: none
button_action:
  tap_action:
    action: navigate
    navigation_path: "#vigieau"
  double_tap_action:
    action: none
  hold_action:
    action: none
2 « J'aime »

Je résume car ça peut vite être confus (désolé pour le flood) :x

L’intégration ce base sur 2 cards. Seule la première est visible et ne donne que les informations nécessaires.
La seconde apparait lors d’un clic sur l’icone ou le bouton et donne la totalité des infos.

La première:
image

Dont voici le code:

type: custom:bubble-card
card_type: button
button_type: state
entity: sensor.alert_level_in_frouzins
name: Vigieau Frouzins
show_state: true
show_attribute: true
scrolling_effect: false
tap_action:
  action: navigate
  navigation_path: "#vigieau"
double_tap_action:
  action: none
hold_action:
  action: none
button_action:
  tap_action:
    action: navigate
    navigation_path: "#vigieau"
  double_tap_action:
    action: none
  hold_action:
    action: none
card_layout: large
styles: |
  .bubble-button-card-container {
    background: ${ 
      hass.states['sensor.alert_level_in_frouzins']?.state === 'vigilance (pas de restriction)'
      ? 'rgba(var(--rgb-secondary-text-color), 0.2)'
      : hass.states['sensor.alert_level_in_frouzins']?.state === 'Crise'
      ? 'rgba(255, 0, 0, 0.2)'
      : hass.states['sensor.alert_level_in_frouzins']?.state === 'Alerte renforcée'
      ? 'rgba(255, 165, 0, 0.2)'
      : hass.states['sensor.alert_level_in_frouzins']?.state === 'Alerte'
      ? 'rgba(255, 255, 0, 0.2)'
      : 'rgba(0, 128, 0, 0.2)'
    } !important;
  }
  .bubble-button-card-container .bubble-icon {
    color: ${ 
      hass.states['sensor.alert_level_in_frouzins']?.state === 'vigilance (pas de restriction)'
      ? 'rgb(135, 182, 209)'
      : hass.states['sensor.alert_level_in_frouzins']?.state === 'Crise'
      ? 'rgb(255, 0, 0)'
      : hass.states['sensor.alert_level_in_frouzins']?.state === 'Alerte renforcée'
      ? 'rgb(255, 165, 0)'
      : hass.states['sensor.alert_level_in_frouzins']?.state === 'Alerte'
      ? 'rgb(255, 255, 0)'
      : 'rgb(0, 128, 0)'
    } !important;
    background-color: ${ 
      hass.states['sensor.alert_level_in_frouzins']?.state === 'vigilance (pas de restriction)'
      ? 'rgba(76, 124, 30, 0.2)'
      : hass.states['sensor.alert_level_in_frouzins']?.state === 'Crise'
      ? 'rgba(255, 0, 0, 0.2)'
      : hass.states['sensor.alert_level_in_frouzins']?.state === 'Alerte renforcée'
      ? 'rgba(255, 165, 0, 0.2)'
      : hass.states['sensor.alert_level_in_frouzins']?.state === 'Alerte'
      ? 'rgba(255, 255, 0, 0.2)'
      : 'rgba(0, 128, 0, 0.2)'
    } !important;
    border-radius: 50% !important;
    padding: 5px !important;
  }

  .bubble-sub-button-1 {
      background: ${ hass.states['sensor.arrosage_des_jardins_potagers_restrictions_frouzins']?.state === 'vigilance (pas de restriction)'
      ? 'rgba(247, 53, 67, 0.4)'
      : ''
      } !important;
      color: ${ 
          hass.states['sensor.arrosage_des_jardins_potagers_restrictions_frouzins']?.state === 'vigilance (pas de restriction)'
          ? ''
          : hass.states['sensor.arrosage_des_jardins_potagers_restrictions_frouzins']?.state === 'Crise'
          ? 'red'
          : hass.states['sensor.arrosage_des_jardins_potagers_restrictions_frouzins']?.state === 'Alerte renforcée'
          ? 'orange'
          : hass.states['sensor.arrosage_des_jardins_potagers_restrictions_frouzins']?.state === 'Alerte'
          ? 'yellow'
          : 'green'
      } !important;
  }

  .bubble-sub-button-2 {
      background: ${ hass.states['sensor.arrosage_des_pelouses_restrictions_frouzins']?.state === 'vigilance (pas de restriction)'
      ? 'rgba(247, 53, 67, 0.4)'
      : ''
      } !important;
      color: ${ 
          hass.states['sensor.arrosage_des_pelouses_restrictions_frouzins']?.state === 'vigilance (pas de restriction)'
          ? ''
          : hass.states['sensor.arrosage_des_pelouses_restrictions_frouzins']?.state === 'Crise'
          ? 'red'
          : hass.states['sensor.arrosage_des_pelouses_restrictions_frouzins']?.state === 'Alerte renforcée'
          ? 'orange'
          : hass.states['sensor.arrosage_des_pelouses_restrictions_frouzins']?.state === 'Alerte'
          ? 'yellow'
          : 'green'
      } !important;
  }

  .bubble-sub-button-3 {
      background: ${ hass.states['sensor.vidange_et_remplissage_des_piscines_restrictions_frouzins']?.state === 'vigilance (pas de restriction)'
      ? 'rgba(247, 53, 67, 0.4)'
      : ''
      } !important;
      color: ${ 
          hass.states['sensor.vidange_et_remplissage_des_piscines_restrictions_frouzins']?.state === 'vigilance (pas de restriction)'
          ? ''
          : hass.states['sensor.vidange_et_remplissage_des_piscines_restrictions_frouzins']?.state === 'Crise'
          ? 'red'
          : hass.states['sensor.vidange_et_remplissage_des_piscines_restrictions_frouzins']?.state === 'Alerte renforcée'
          ? 'orange'
          : hass.states['sensor.vidange_et_remplissage_des_piscines_restrictions_frouzins']?.state === 'Alerte'
          ? 'yellow'
          : 'green'
      } !important;
  }

  ${(() => {
      const alertlevel = hass.states['sensor.alert_level_in_frouzins']?.state; 
      let icon;

      // Conditions pour définir l'icône
      if (alertlevel === 'vigilance (pas de restriction)') {
        icon = 'mdi:water-check'; 
      } else if (alertlevel === 'Alerte') {
        icon = 'mdi:water-alert'; 
      } else if (alertlevel === 'Alerte renforcée') {
        icon = 'mdi:water-remove';
      } else if (alertlevel === 'Crise') {
        icon = 'mdi:water-off';
      }

      // Applique l'icône
      card.querySelector('.bubble-icon').setAttribute('icon', icon);

      let color;

      // Conditions pour définir la couleur
      if (alertlevel === 'vigilance (pas de restriction)') {
        color = 'green'; 
      } else if (alertlevel === 'Alerte') {
        color = 'yellow'; 
      } else if (alertlevel === 'Alerte renforcée') {
        color = 'orange';
      } else if (alertlevel === 'Crise') {
        color = 'red';
      }

      // Applique la couleur et rend le texte en gras
      card.querySelector('.bubble-state').style.color = color; // Applique la couleur
      card.querySelector('.bubble-state').style.fontWeight = 'bold'; // Texte en gras
      card.querySelector('.bubble-state').style.fontSize = '13px'; // Taille de police à 13 pixels
    })()
  } !important
sub_button:
  - entity: sensor.arrosage_des_jardins_potagers_restrictions_frouzins
  - entity: sensor.arrosage_des_pelouses_restrictions_frouzins
  - entity: sensor.vidange_et_remplissage_des_piscines_restrictions_frouzins
card_mod: null

Et la seconde:

dont voici le code:

type: vertical-stack
cards:
  - type: custom:bubble-card
    card_type: pop-up
    hash: "#vigieau"
    name: Vigieau
    show_header: false
    scrolling_effect: false
    force_icon: false
    show_state: false
    show_last_changed: false
    show_attribute: false
  - type: custom:bubble-card
    card_type: button
    button_type: state
    entity: sensor.alert_level_in_frouzins
    name: Vigieau Frouzins
    show_state: true
    show_attribute: true
    scrolling_effect: false
    tap_action:
      action: none
    double_tap_action:
      action: none
    hold_action:
      action: none
    button_action:
      tap_action:
        action: none
      double_tap_action: null
      action: none
      hold_action:
        action: none
    card_layout: large
    styles: |
      .bubble-button-card-container {
        background: ${ 
          hass.states['sensor.alert_level_in_frouzins']?.state === 'vigilance (pas de restriction)'
          ? 'rgba(var(--rgb-secondary-text-color), 0.2)'
          : hass.states['sensor.alert_level_in_frouzins']?.state === 'Crise'
          ? 'rgba(255, 0, 0, 0.2)'
          : hass.states['sensor.alert_level_in_frouzins']?.state === 'Alerte renforcée'
          ? 'rgba(255, 165, 0, 0.2)'
          : hass.states['sensor.alert_level_in_frouzins']?.state === 'Alerte'
          ? 'rgba(255, 255, 0, 0.2)'
          : 'rgba(0, 128, 0, 0.2)'
        } !important;
      }
      .bubble-button-card-container .bubble-icon {
        color: ${ 
          hass.states['sensor.alert_level_in_frouzins']?.state === 'vigilance (pas de restriction)'
          ? 'rgb(135, 182, 209)'
          : hass.states['sensor.alert_level_in_frouzins']?.state === 'Crise'
          ? 'rgb(255, 0, 0)'
          : hass.states['sensor.alert_level_in_frouzins']?.state === 'Alerte renforcée'
          ? 'rgb(255, 165, 0)'
          : hass.states['sensor.alert_level_in_frouzins']?.state === 'Alerte'
          ? 'rgb(255, 255, 0)'
          : 'rgb(0, 128, 0)'
        } !important;
        background-color: ${ 
          hass.states['sensor.alert_level_in_frouzins']?.state === 'vigilance (pas de restriction)'
          ? 'rgba(76, 124, 30, 0.2)'
          : hass.states['sensor.alert_level_in_frouzins']?.state === 'Crise'
          ? 'rgba(255, 0, 0, 0.2)'
          : hass.states['sensor.alert_level_in_frouzins']?.state === 'Alerte renforcée'
          ? 'rgba(255, 165, 0, 0.2)'
          : hass.states['sensor.alert_level_in_frouzins']?.state === 'Alerte'
          ? 'rgba(255, 255, 0, 0.2)'
          : 'rgba(0, 128, 0, 0.2)'
        } !important;
        border-radius: 50% !important;
        padding: 5px !important;
      }

      ${(() => {
          const alertlevel = hass.states['sensor.alert_level_in_frouzins']?.state; 
          let icon;

          // Conditions pour définir l'icône
          if (alertlevel === 'vigilance (pas de restriction)') {
            icon = 'mdi:water-check'; 
          } else if (alertlevel === 'Alerte') {
            icon = 'mdi:water-alert'; 
          } else if (alertlevel === 'Alerte renforcée') {
            icon = 'mdi:water-remove';
          } else if (alertlevel === 'Crise') {
            icon = 'mdi:water-off';
          }

          // Applique l'icône
          card.querySelector('.bubble-icon').setAttribute('icon', icon);

          let color;

          // Conditions pour définir la couleur
          if (alertlevel === 'vigilance (pas de restriction)') {
            color = 'green'; 
          } else if (alertlevel === 'Alerte') {
            color = 'yellow'; 
          } else if (alertlevel === 'Alerte renforcée') {
            color = 'orange';
          } else if (alertlevel === 'Crise') {
            color = 'red';
          }

          // Applique la couleur et rend le texte en gras
          card.querySelector('.bubble-state').style.color = color; // Applique la couleur
          card.querySelector('.bubble-state').style.fontWeight = 'bold'; // Texte en gras
          card.querySelector('.bubble-state').style.fontSize = '13px'; // Taille de police à 13 pixels
        })()
      } !important
  - type: custom:bubble-card
    card_type: separator
  - type: custom:auto-entities
    card:
      type: custom:vertical-stack-in-card
    card_param: cards
    filter:
      include:
        - entity_id: sensor.*_restrictions_frouzins
          options:
            type: custom:mushroom-template-card
            primary: "{{ state_attr(entity,'friendly_name')}}"
            secondary: "{{states(entity)}}"
            icon: "{{ state_attr(entity,'icon')}}"
            icon_color: |-
              {% if is_state(entity, 'Interdiction') %} 
                red
              {% elif is_state(entity, 'Interdiction sur plage horaire') %} 
                orange
              {% elif is_state(entity, 'Interdiction sauf exception') %} 
                orange
              {% elif is_state(entity, 'Aucune restriction') %} 
                green
              {% else %}
                grey
              {% endif %}
            layout: horizontal
            tap_action:
              action: more-info
            hold_action:
              action: more-info
            double_tap_action:
              action: more-info

N’hésitez pas à l’améliorer !

z.

3 « J'aime »

re,

A priori la dernière ligne de la carte 1 ne sert à rien :wink:

cdt