Récupérer son prix de carburant (encore) avec le multiscraping

Merci @Pulpy !

Voici ce que cela donne pour moi. J’ai rajouté les logos centrés à 40px, une couleur GreenLime, pas de gras pour le chiffre en rouge et divisé en deux pour deux villes.

# CARBURANTS CHALON
  - type: custom:stack-in-card
    cards:
      - type: markdown
        content: >-
            {%- set items = {1:'e10', 0:'sp95'} -%}
            {%- set colormin = '#32CD32' -%}
            {%- set colormax = 'red' -%}
            {%- set prices = namespace(minima=[],maxima=[],update='') -%}
            {%- for i in range(items|length) -%}
              {%- set tmp = expand('group.carburants_chalon')
                  |selectattr('attributes.'+items[i]+'_price', 'ne', '-') 
                  |map(attribute='attributes.'+items[i]+'_price')|list -%}
              {%- set prices.minima = prices.minima + [min(tmp)] -%}
              {%- set prices.maxima = prices.maxima + [max(tmp)] -%}
            {%- endfor -%}
            {%- set carburants_entities = expand('group.carburants_chalon') | map(attribute='entity_id')|list -%}
            <table><thead><tr> <th colspan="2">Stations Chalon</th>
            {%- for j in range(items|length) -%}
              {{ '<th>'+items[j]|upper+' €/L</th>' }}
            {%- endfor -%}
            <th>Date</th> </tr></thead><tbody>
              {%- for carburants_entity in carburants_entities -%}
              {%- set prices.update = '01/01/20' -%}
              {%- set nd = 0 -%}
                <tr>
                <td align='center'><img src="{{state_attr(carburants_entity, 'entity_picture')}}" height="40"> </td>
                <td>{{states(carburants_entity)}}</td>
                {%- for k in range(items|length) -%}
                  {%- set price=state_attr(carburants_entity, items[k]+'_price') -%}
                  <td align='center'>
                  {%- if price==prices.minima[k] -%}
                    {{ '<font color='+colormin+'><b>'+price+'</b></font>' }}
                  {%- elif price==prices.maxima[k] -%}
                    {{ '<font color='+colormax+'>'+price+'</font>' }}
                  {%- else -%}
                    {{price}}
                  {%- endif -%}
                  {%- set ndstr = state_attr(carburants_entity, items[k]+'_date') -%}
                  {%- if ndstr != '-' -%}
                    {%- set nd = strptime(ndstr, '%d/%m/%y')|as_timestamp -%}
                      {%- if nd >= strptime(prices.update, '%d/%m/%y')|as_timestamp -%}
                            {%- set prices.update = ndstr -%}
                      {%- endif -%}
                  {%- endif -%}
                  </td>
                {%- endfor -%}
                <td>{{ prices.update }}</td>
                </tr>
              {%- endfor -%}
            </tr></tbody></table>
# CARBURANTS LE CREUSOT
  - type: custom:stack-in-card
    cards:
      - type: markdown
        content: >-
            {%- set items = {1:'e10', 0:'sp95'} -%}
            {%- set colormin = '#32CD32' -%}
            {%- set colormax = 'red' -%}
            {%- set prices = namespace(minima=[],maxima=[],update='') -%}
            {%- for i in range(items|length) -%}
              {%- set tmp = expand('group.carburants_creusot')
                  |selectattr('attributes.'+items[i]+'_price', 'ne', '-') 
                  |map(attribute='attributes.'+items[i]+'_price')|list -%}
              {%- set prices.minima = prices.minima + [min(tmp)] -%}
              {%- set prices.maxima = prices.maxima + [max(tmp)] -%}
            {%- endfor -%}
            {%- set carburants_entities = expand('group.carburants_creusot') | map(attribute='entity_id')|list -%}
            <table><thead><tr> <th colspan="2">Stations Le Creusot</th>
            {%- for j in range(items|length) -%}
              {{ '<th>'+items[j]|upper+' €/L</th>' }}
            {%- endfor -%}
            <th>Date</th> </tr></thead><tbody>
              {%- for carburants_entity in carburants_entities -%}
              {%- set prices.update = '01/01/20' -%}
              {%- set nd = 0 -%}
                <tr>
                <td align='center'><img src="{{state_attr(carburants_entity, 'entity_picture')}}" height="40"> </td>
                <td>{{states(carburants_entity)}}</td>
                {%- for k in range(items|length) -%}
                  {%- set price=state_attr(carburants_entity, items[k]+'_price') -%}
                  <td align='center'>
                  {%- if price==prices.minima[k] -%}
                    {{ '<font color='+colormin+'><b>'+price+'</b></font>' }}
                  {%- elif price==prices.maxima[k] -%}
                    {{ '<font color='+colormax+'>'+price+'</font>' }}
                  {%- else -%}
                    {{price}}
                  {%- endif -%}
                  {%- set ndstr = state_attr(carburants_entity, items[k]+'_date') -%}
                  {%- if ndstr != '-' -%}
                    {%- set nd = strptime(ndstr, '%d/%m/%y')|as_timestamp -%}
                      {%- if nd >= strptime(prices.update, '%d/%m/%y')|as_timestamp -%}
                            {%- set prices.update = ndstr -%}
                      {%- endif -%}
                  {%- endif -%}
                  </td>
                {%- endfor -%}
                <td>{{ prices.update }}</td>
                </tr>
              {%- endfor -%}
            </tr></tbody></table>

Résultat :

1 « J'aime »

Donc ça récupère bien les dates quand il y en a. Cool

@Pulpy Bonjour,

J’ai bien suivi ton tutoriel malheureusement rien ne marche, je n’ai aucun sensor qui apparait.
J’ai pourtant bien ajouté la carte multiscraping. J’ai d’abord essayé ton code, que j’ai ajouté à ma configuration.yaml :

multiscrape:
  - name: carburants_auchan_bordeaux
    resource: "https://carbu.com/france/index.php/station/auchan/bordeaux/33000/5246"
    scan_interval: 3600
    sensor:
      - unique_id: carburants_auchan_bordeaux
        select: "[itemtype='http://data-vocabulary.org/Organization'] h1"
        value_template: "{{ value }}"
        attributes:
          - name: sp98_name
            select: ".col-xs-12:nth-of-type(1) h2"
          - name: sp98_price
            select: ".col-xs-12:nth-of-type(1) h1.price"
            value_template: "{{ value|replace(',','.') }}"
          - name: sp98_date
            select: ".col-xs-12:nth-of-type(1) p.sources"
            value_template: "{{ value.split(' ')[0] }}"
          - name: e10_name
            select: ".col-xs-12:nth-of-type(3) h2"
          - name: e10_price
            select: ".col-xs-12:nth-of-type(3) h1.price"
            value_template: "{{ value|replace(',','.') }}"
          - name: e10_date
            select: ".col-xs-12:nth-of-type(3) p.sources"
            value_template: "{{ value.split(' ')[0] }}"
          - name: gpl_name
            select: ".col-xs-12:nth-of-type(6) h2"
          - name: gpl_price
            select: ".col-xs-12:nth-of-type(6) h1.price"
            value_template: "{{ value|replace(',','.') }}"
          - name: gpl_date
            select: ".col-xs-12:nth-of-type(6) p.sources"
            value_template: "{{ value.split(' ')[0] }}"

Cependant rien ne remonte dans les entités. Et quand je le teste dans modèle j’obtiens ce message d’erreur :

Pourrais tu m’aider ?

Merci =)

Salut,

Ce qu’il faut faire, c’est mettre dans ce code un fichier configuration.yaml (création d’un sensor). Comme tu le fais actuellement : dans les outils développeur, c’est sûr que ça ne fonctionne pas.

La carte c’est la partie affichage, ce qu’il faut installer en premier lieu c’est le composant multiscraping. J’imagine que c’est ce que tu as fait.

@Pulpy Merci pour ta réactivité !

Alors oui je pense avoir fait ça correctement cf ci-dessous


ok, vu comme ça, ça semble correct.
Tu as relancé le core pour la prise en compte de tout ça ?

:sweat_smile: Alors effectivement ton code fonctionne après redémarrage (désolé j’avais zappé qu’il fallait relancer).

Je te remercie @Pulpy !!! Le code personnalisé avec mes infos fonctionne désormais :grin: :grin: :grin: :grin:

Excellente journée :wink:

1 « J'aime »

C’est le métier qui rentre :wink:

1 « J'aime »

Salut,
J’en profite pour mettre mon petit merci à mon tour :wink:.
Ça fonctionne super.
Seuls les prix font peur.

1 « J'aime »

Je viensde test

Card:

type: custom:vertical-stack-in-card
card_mod:
  style: |
    ha-card {
     --ha-card-background: rgba(0, 0, 0, 0.1);
    ha-card {
      margin-top: 0em;
        }         
mode: vertical
cards:
  - type: picture-entity
    entity: binary_sensor.nas_1621_security_status
    image: /local/img/essence.jpeg
    show_name: true
    show_state: false
    name: Station Service
    tap_action:
      action: none
    hold_action:
      action: none
  - type: divider
    style:
      height: 2px
      width: 100%
      margin-left: auto
      margin-right: auto
      background: rgba(255, 255, 255, 0.5)
  - type: custom:flex-table-card
    sort_by: diesel_price
    entities:
      include: sensor.carburants_*
    columns:
      - data: state
        icon: mdi:gas-station
        align: left
      - name: Diesel
        data: diesel_price
        align: center
      - name: Update
        data: diesel_date
        align: center
    css:
      tbody tr:nth-child(odd): 'background-color: rgba(255, 255, 255, 0.2)'
      tbody tr:nth-child(even): 'background-color: rgba(255, 255, 255, 0.1)'
      tbody tr:nth-child(1): 'color: #00ff00'
      tbody tr:nth-child(5): 'color: #FF0000'
    card_mod:
      style: |
        ha-card {
        border-radius: 10px;
        padding-bottom: 10px;
        background-color: rgba(0, 0, 0, 0.1)
        }
        :host {
        font-size: 13px;
        border-radius: 10px;
        }
  - type: divider
    style:
      height: 2px
      width: 100%
      margin-left: auto
      margin-right: auto
      background: rgba(255, 255, 255, 0.5)
  - type: custom:flex-table-card
    sort_by: sp95_e10_price
    entities:
      include: sensor.carburants_*
    columns:
      - data: state
        icon: mdi:gas-station
        align: left
      - name: SP95
        data: sp95_e10_price
        align: center
      - name: Update
        data: sp95_e10_date
        align: center
    css:
      tbody tr:nth-child(odd): 'background-color: rgba(255, 255, 255, 0.2)'
      tbody tr:nth-child(even): 'background-color: rgba(255, 255, 255, 0.1)'
      tbody tr:nth-child(1): 'color: #00ff00'
      tbody tr:nth-child(5): 'color: #FF0000'
    card_mod:
      style: |
        ha-card {
        border-radius: 10px;
        background-color: rgba(0, 0, 0, 0.1)
        }
        :host {
        font-size: 13px;
        border-radius: 10px;
        }

et mon sensor:

multiscrape:
  - name: carburants_intermarcher_herblay
    resource: "https://carbu.com/france/index.php/station/super-u/herblay/95220/19398"
    scan_interval: 3600
    sensor:
      - unique_id: carburants_intermarche_herblay
        select: "[itemtype='http://data-vocabulary.org/Organization'] h1"
        value_template: "{{ value }}"
        attributes:
          - name: sp98_name
            select: ".col-xs-12:nth-of-type(1) h2"
          - name: sp98_price
            select: ".col-xs-12:nth-of-type(1) h1.price"
            value_template: "{{ value|replace(',','.') }}"
          - name: sp98_date
            select: ".col-xs-12:nth-of-type(1) p.sources"
            value_template: "{{ value.split(' ')[0] }}"
          - name: sp95_e10_name
            select: ".col-xs-12:nth-of-type(3) h2.title"
          - name: sp95_e10_price
            select: ".col-xs-12:nth-of-type(3) h1"
            value_template: "{{ value|replace(',','.') }}"
          - name: sp95_e10_date
            select: ".col-xs-12:nth-of-type(3) p.sources"
            value_template: "{{ value.split(' ')[0] }}"
          - name: bio_e85_name
            select: ".col-xs-12:nth-of-type(4) h2"
          - name: bio_e85_price
            select: ".col-xs-12:nth-of-type(4) h1"
            value_template: "{{ value|replace(',','.') }}"
          - name: bio_e85_date
            select: ".col-xs-12:nth-of-type(4) p.sources"
            value_template: "{{ value.split(' ')[0] }}"
          - name: diesel_name
            select: ".col-xs-12:nth-of-type(5) h2"
          - name: diesel_price
            select: ".col-xs-12:nth-of-type(5) h1"
            value_template: "{{ value|replace(',','.') }}"
          - name: diesel_date
            select: ".col-xs-12:nth-of-type(5) p"
            value_template: "{{ value.split(' ')[0] }}"
  - name: carburants_carrefour_herblay
    resource: "https://carbu.com/france/index.php/station/carrefour-market/conflans-sainte-honorine/78700/9714"
    scan_interval: 3600
    sensor:
      - unique_id: carburants_carrefour_herblay
        select: "[itemtype='http://data-vocabulary.org/Organization'] h1"
        value_template: "{{ value }}"
        attributes:
          - name: sp98_name
            select: ".col-xs-12:nth-of-type(1) h2"
          - name: sp98_price
            select: ".col-xs-12:nth-of-type(1) h1.price"
            value_template: "{{ value|replace(',','.') }}"
          - name: sp98_date
            select: ".col-xs-12:nth-of-type(1) p.sources"
            value_template: "{{ value.split(' ')[0] }}"
          - name: sp95_e10_name
            select: ".col-xs-12:nth-of-type(3) h2.title"
          - name: sp95_e10_price
            select: ".col-xs-12:nth-of-type(3) h1"
            value_template: "{{ value|replace(',','.') }}"
          - name: sp95_e10_date
            select: ".col-xs-12:nth-of-type(3) p.sources"
            value_template: "{{ value.split(' ')[0] }}"
          - name: bio_e85_name
            select: ".col-xs-12:nth-of-type(4) h2"
          - name: bio_e85_price
            select: ".col-xs-12:nth-of-type(4) h1"
            value_template: "{{ value|replace(',','.') }}"
          - name: bio_e85_date
            select: ".col-xs-12:nth-of-type(4) p.sources"
            value_template: "{{ value.split(' ')[0] }}"
          - name: diesel_name
            select: ".col-xs-12:nth-of-type(5) h2"
          - name: diesel_price
            select: ".col-xs-12:nth-of-type(5) h1"
            value_template: "{{ value|replace(',','.') }}"
          - name: diesel_date
            select: ".col-xs-12:nth-of-type(5) p"
            value_template: "{{ value.split(' ')[0] }}"
  - name: carburants_auchan_herblay
    resource: "https://carbu.com/france/index.php/station/auchan-supermarche/conflans-sainte-honorine/78700/18135"
    scan_interval: 3600
    sensor:
      - unique_id: carburants_auchan_herblay
        select: "[itemtype='http://data-vocabulary.org/Organization'] h1"
        value_template: "{{ value }}"
        attributes:
          - name: sp98_name
            select: ".col-xs-12:nth-of-type(1) h2"
          - name: sp98_price
            select: ".col-xs-12:nth-of-type(1) h1.price"
            value_template: "{{ value|replace(',','.') }}"
          - name: sp98_date
            select: ".col-xs-12:nth-of-type(1) p.sources"
            value_template: "{{ value.split(' ')[0] }}"
          - name: sp95_e10_name
            select: ".col-xs-12:nth-of-type(3) h2.title"
          - name: sp95_e10_price
            select: ".col-xs-12:nth-of-type(3) h1"
            value_template: "{{ value|replace(',','.') }}"
          - name: sp95_e10_date
            select: ".col-xs-12:nth-of-type(3) p.sources"
            value_template: "{{ value.split(' ')[0] }}"
          - name: bio_e85_name
            select: ".col-xs-12:nth-of-type(4) h2"
          - name: bio_e85_price
            select: ".col-xs-12:nth-of-type(4) h1"
            value_template: "{{ value|replace(',','.') }}"
          - name: bio_e85_date
            select: ".col-xs-12:nth-of-type(4) p.sources"
            value_template: "{{ value.split(' ')[0] }}"
          - name: diesel_name
            select: ".col-xs-12:nth-of-type(5) h2"
          - name: diesel_price
            select: ".col-xs-12:nth-of-type(5) h1"
            value_template: "{{ value|replace(',','.') }}"
          - name: diesel_date
            select: ".col-xs-12:nth-of-type(5) p"
            value_template: "{{ value.split(' ')[0] }}"
  - name: carburants_bp_herblay
    resource: "https://carbu.com/france/index.php/station/bp/eragny/95610/6635"
    scan_interval: 3600
    sensor:
      - unique_id: carburants_bp_herblay
        select: "[itemtype='http://data-vocabulary.org/Organization'] h1"
        value_template: "{{ value }}"
        attributes:
          - name: sp98_name
            select: ".col-xs-12:nth-of-type(1) h2"
          - name: sp98_price
            select: ".col-xs-12:nth-of-type(1) h1.price"
            value_template: "{{ value|replace(',','.') }}"
          - name: sp98_date
            select: ".col-xs-12:nth-of-type(1) p.sources"
            value_template: "{{ value.split(' ')[0] }}"
          - name: sp95_e10_name
            select: ".col-xs-12:nth-of-type(3) h2.title"
          - name: sp95_e10_price
            select: ".col-xs-12:nth-of-type(3) h1"
            value_template: "{{ value|replace(',','.') }}"
          - name: sp95_e10_date
            select: ".col-xs-12:nth-of-type(3) p.sources"
            value_template: "{{ value.split(' ')[0] }}"
          - name: bio_e85_name
            select: ".col-xs-12:nth-of-type(4) h2"
          - name: bio_e85_price
            select: ".col-xs-12:nth-of-type(4) h1"
            value_template: "{{ value|replace(',','.') }}"
          - name: bio_e85_date
            select: ".col-xs-12:nth-of-type(4) p.sources"
            value_template: "{{ value.split(' ')[0] }}"
          - name: diesel_name
            select: ".col-xs-12:nth-of-type(5) h2"
          - name: diesel_price
            select: ".col-xs-12:nth-of-type(5) h1"
            value_template: "{{ value|replace(',','.') }}"
          - name: diesel_date
            select: ".col-xs-12:nth-of-type(5) p"
            value_template: "{{ value.split(' ')[0] }}"
  - name: carburants_total_herblay
    resource: "https://carbu.com/france/index.php/station/totalenergies/pierrelaye/95480/15242"
    scan_interval: 3600
    sensor:
      - unique_id: carburants_total_herblay
        select: "[itemtype='http://data-vocabulary.org/Organization'] h1"
        value_template: "{{ value }}"
        attributes:
          - name: sp98_name
            select: ".col-xs-12:nth-of-type(1) h2"
          - name: sp98_price
            select: ".col-xs-12:nth-of-type(1) h1.price"
            value_template: "{{ value|replace(',','.') }}"
          - name: sp98_date
            select: ".col-xs-12:nth-of-type(1) p.sources"
            value_template: "{{ value.split(' ')[0] }}"
          - name: sp95_e10_name
            select: ".col-xs-12:nth-of-type(3) h2.title"
          - name: sp95_e10_price
            select: ".col-xs-12:nth-of-type(3) h1"
            value_template: "{{ value|replace(',','.') }}"
          - name: sp95_e10_date
            select: ".col-xs-12:nth-of-type(3) p.sources"
            value_template: "{{ value.split(' ')[0] }}"
          - name: bio_e85_name
            select: ".col-xs-12:nth-of-type(4) h2"
          - name: bio_e85_price
            select: ".col-xs-12:nth-of-type(4) h1"
            value_template: "{{ value|replace(',','.') }}"
          - name: bio_e85_date
            select: ".col-xs-12:nth-of-type(4) p.sources"
            value_template: "{{ value.split(' ')[0] }}"
          - name: diesel_name
            select: ".col-xs-12:nth-of-type(5) h2"
          - name: diesel_price
            select: ".col-xs-12:nth-of-type(5) h1"
            value_template: "{{ value|replace(',','.') }}"
          - name: diesel_date
            select: ".col-xs-12:nth-of-type(5) p"
            value_template: "{{ value.split(' ')[0] }}"

Rien qui s’affiche je comprend pas :frowning:

ça déjà ça aide pas :wink: c’est de l’e10 ou du sp95 mais pas les 2
idem pour
- name: sp95_e10_name
- name: sp95_e10_price
- name: sp95_e10_date

ça vient de mon code ???

EDIT
En version brut, le sensor est presque OK même si les noms me perturbent… de l’e85 nommé SP95 :nauseated_face:

La carte expurgée du reste aussi

Et la carte compléte aussi

Donc ça sent le probléme de redémarrage et donc pas prise en compte du sensor

1 « J'aime »
card_mod:
  style: |
    ha-card {
     --ha-card-background: rgba(0, 0, 0, 0.1);
    ha-card {
      margin-top: 0em;
        }         

tu peu optimiser comme ca

card_mod:
  style: |
    ha-card {
      --ha-card-background: rgba(0, 0, 0, 0.1);
      margin-top: 0em;
   }         
    card_mod:
      style: |
        ha-card {
        border-radius: 10px;
        padding-bottom: 10px;
        background-color: rgba(0, 0, 0, 0.1) <<< manque un ;
        }
        :host {
        font-size: 13px;
        border-radius: 10px;
        }
1 « J'aime »

Yes

Copier/coller de ton code :frowning:

En fait, la seule occurrence de ce format de nom, c’est chez @Guizmos ici
En soit, c’est pas fondamentalement gênant, mais comme c’est pas du tout le format que j’utilise, il faut réadapter systématiquement

J’ai remis les bons nom pour que ce sois plus cohérent :

mon sensor :

multiscrape:
  - name: carburants_intermarcher_herblay
    resource: "https://carbu.com/france/index.php/station/super-u/herblay/95220/19398"
    scan_interval: 3600
    sensor:
      - unique_id: carburants_intermarche_herblay
        select: "[itemtype='http://data-vocabulary.org/Organization'] h1"
        value_template: "{{ value }}"
        attributes:
          - name: sp98_name
            select: ".col-xs-12:nth-of-type(1) h2"
          - name: sp98_price
            select: ".col-xs-12:nth-of-type(1) h1.price"
            value_template: "{{ value|replace(',','.') }}"
          - name: sp98_date
            select: ".col-xs-12:nth-of-type(1) p.sources"
            value_template: "{{ value.split(' ')[0] }}"
          - name: sp95_name
            select: ".col-xs-12:nth-of-type(3) h2.title"
          - name: sp95_price
            select: ".col-xs-12:nth-of-type(3) h1"
            value_template: "{{ value|replace(',','.') }}"
          - name: sp95_date
            select: ".col-xs-12:nth-of-type(3) p.sources"
            value_template: "{{ value.split(' ')[0] }}"
          - name: e85_name
            select: ".col-xs-12:nth-of-type(4) h2"
          - name: e85_price
            select: ".col-xs-12:nth-of-type(4) h1"
            value_template: "{{ value|replace(',','.') }}"
          - name: e85_date
            select: ".col-xs-12:nth-of-type(4) p.sources"
            value_template: "{{ value.split(' ')[0] }}"
          - name: diesel_name
            select: ".col-xs-12:nth-of-type(5) h2"
          - name: diesel_price
            select: ".col-xs-12:nth-of-type(5) h1"
            value_template: "{{ value|replace(',','.') }}"
          - name: diesel_date
            select: ".col-xs-12:nth-of-type(5) p"
            value_template: "{{ value.split(' ')[0] }}"
  - name: carburants_carrefour_herblay
    resource: "https://carbu.com/france/index.php/station/carrefour-market/conflans-sainte-honorine/78700/9714"
    scan_interval: 3600
    sensor:
      - unique_id: carburants_carrefour_herblay
        select: "[itemtype='http://data-vocabulary.org/Organization'] h1"
        value_template: "{{ value }}"
        attributes:
          - name: sp98_name
            select: ".col-xs-12:nth-of-type(1) h2"
          - name: sp98_price
            select: ".col-xs-12:nth-of-type(1) h1.price"
            value_template: "{{ value|replace(',','.') }}"
          - name: sp98_date
            select: ".col-xs-12:nth-of-type(1) p.sources"
            value_template: "{{ value.split(' ')[0] }}"
          - name: sp95_name
            select: ".col-xs-12:nth-of-type(3) h2.title"
          - name: sp95_price
            select: ".col-xs-12:nth-of-type(3) h1"
            value_template: "{{ value|replace(',','.') }}"
          - name: sp95_date
            select: ".col-xs-12:nth-of-type(3) p.sources"
            value_template: "{{ value.split(' ')[0] }}"
          - name: e85_name
            select: ".col-xs-12:nth-of-type(4) h2"
          - name: e85_price
            select: ".col-xs-12:nth-of-type(4) h1"
            value_template: "{{ value|replace(',','.') }}"
          - name: e85_date
            select: ".col-xs-12:nth-of-type(4) p.sources"
            value_template: "{{ value.split(' ')[0] }}"
          - name: diesel_name
            select: ".col-xs-12:nth-of-type(5) h2"
          - name: diesel_price
            select: ".col-xs-12:nth-of-type(5) h1"
            value_template: "{{ value|replace(',','.') }}"
          - name: diesel_date
            select: ".col-xs-12:nth-of-type(5) p"
            value_template: "{{ value.split(' ')[0] }}"
  - name: carburants_auchan_herblay
    resource: "https://carbu.com/france/index.php/station/auchan-supermarche/conflans-sainte-honorine/78700/18135"
    scan_interval: 3600
    sensor:
      - unique_id: carburants_auchan_herblay
        select: "[itemtype='http://data-vocabulary.org/Organization'] h1"
        value_template: "{{ value }}"
        attributes:
          - name: sp98_name
            select: ".col-xs-12:nth-of-type(1) h2"
          - name: sp98_price
            select: ".col-xs-12:nth-of-type(1) h1.price"
            value_template: "{{ value|replace(',','.') }}"
          - name: sp98_date
            select: ".col-xs-12:nth-of-type(1) p.sources"
            value_template: "{{ value.split(' ')[0] }}"
          - name: sp95_name
            select: ".col-xs-12:nth-of-type(3) h2.title"
          - name: sp95price
            select: ".col-xs-12:nth-of-type(3) h1"
            value_template: "{{ value|replace(',','.') }}"
          - name: sp95_date
            select: ".col-xs-12:nth-of-type(3) p.sources"
            value_template: "{{ value.split(' ')[0] }}"
          - name: e85_name
            select: ".col-xs-12:nth-of-type(4) h2"
          - name: e85_price
            select: ".col-xs-12:nth-of-type(4) h1"
            value_template: "{{ value|replace(',','.') }}"
          - name: e85_date
            select: ".col-xs-12:nth-of-type(4) p.sources"
            value_template: "{{ value.split(' ')[0] }}"
          - name: diesel_name
            select: ".col-xs-12:nth-of-type(5) h2"
          - name: diesel_price
            select: ".col-xs-12:nth-of-type(5) h1"
            value_template: "{{ value|replace(',','.') }}"
          - name: diesel_date
            select: ".col-xs-12:nth-of-type(5) p"
            value_template: "{{ value.split(' ')[0] }}"
  - name: carburants_bp_herblay
    resource: "https://carbu.com/france/index.php/station/bp/eragny/95610/6635"
    scan_interval: 3600
    sensor:
      - unique_id: carburants_bp_herblay
        select: "[itemtype='http://data-vocabulary.org/Organization'] h1"
        value_template: "{{ value }}"
        attributes:
          - name: sp98_name
            select: ".col-xs-12:nth-of-type(1) h2"
          - name: sp98_price
            select: ".col-xs-12:nth-of-type(1) h1.price"
            value_template: "{{ value|replace(',','.') }}"
          - name: sp98_date
            select: ".col-xs-12:nth-of-type(1) p.sources"
            value_template: "{{ value.split(' ')[0] }}"
          - name: sp95_name
            select: ".col-xs-12:nth-of-type(3) h2.title"
          - name: sp95_price
            select: ".col-xs-12:nth-of-type(3) h1"
            value_template: "{{ value|replace(',','.') }}"
          - name: sp95_date
            select: ".col-xs-12:nth-of-type(3) p.sources"
            value_template: "{{ value.split(' ')[0] }}"
          - name: e85_name
            select: ".col-xs-12:nth-of-type(4) h2"
          - name: e85_price
            select: ".col-xs-12:nth-of-type(4) h1"
            value_template: "{{ value|replace(',','.') }}"
          - name: e85_date
            select: ".col-xs-12:nth-of-type(4) p.sources"
            value_template: "{{ value.split(' ')[0] }}"
          - name: diesel_name
            select: ".col-xs-12:nth-of-type(5) h2"
          - name: diesel_price
            select: ".col-xs-12:nth-of-type(5) h1"
            value_template: "{{ value|replace(',','.') }}"
          - name: diesel_date
            select: ".col-xs-12:nth-of-type(5) p"
            value_template: "{{ value.split(' ')[0] }}"
  - name: carburants_total_herblay
    resource: "https://carbu.com/france/index.php/station/totalenergies/pierrelaye/95480/15242"
    scan_interval: 3600
    sensor:
      - unique_id: carburants_total_herblay
        select: "[itemtype='http://data-vocabulary.org/Organization'] h1"
        value_template: "{{ value }}"
        attributes:
          - name: sp98_name
            select: ".col-xs-12:nth-of-type(1) h2"
          - name: sp98_price
            select: ".col-xs-12:nth-of-type(1) h1.price"
            value_template: "{{ value|replace(',','.') }}"
          - name: sp98_date
            select: ".col-xs-12:nth-of-type(1) p.sources"
            value_template: "{{ value.split(' ')[0] }}"
          - name: sp95_name
            select: ".col-xs-12:nth-of-type(3) h2.title"
          - name: sp95_price
            select: ".col-xs-12:nth-of-type(3) h1"
            value_template: "{{ value|replace(',','.') }}"
          - name: sp95_date
            select: ".col-xs-12:nth-of-type(3) p.sources"
            value_template: "{{ value.split(' ')[0] }}"
          - name: e85_name
            select: ".col-xs-12:nth-of-type(4) h2"
          - name: e85_price
            select: ".col-xs-12:nth-of-type(4) h1"
            value_template: "{{ value|replace(',','.') }}"
          - name: e85_date
            select: ".col-xs-12:nth-of-type(4) p.sources"
            value_template: "{{ value.split(' ')[0] }}"
          - name: diesel_name
            select: ".col-xs-12:nth-of-type(5) h2"
          - name: diesel_price
            select: ".col-xs-12:nth-of-type(5) h1"
            value_template: "{{ value|replace(',','.') }}"
          - name: diesel_date
            select: ".col-xs-12:nth-of-type(5) p"
            value_template: "{{ value.split(' ')[0] }}"

Ici dans la partie Dev-Tools:

et ma foutu carte qui ne s’affiche pas :

type: custom:vertical-stack-in-card
card_mod:
  style: |
    ha-card {
    border-radius: 10px;
    padding-bottom: 10px;
    background-color: rgba(0, 0, 0, 0.1)
    }
    :host {
    font-size: 13px;
    border-radius: 10px;
    }       
mode: vertical
cards:
  - type: picture-entity
    entity: binary_sensor.nas_1621_security_status
    image: /local/img/essence.jpeg
    show_name: true
    show_state: false
    name: Station Service
    tap_action:
      action: none
    hold_action:
      action: none
  - type: divider
    style:
      height: 2px
      width: 100%
      margin-left: auto
      margin-right: auto
      background: rgba(255, 255, 255, 0.5)
  - type: custom:flex-table-card
    sort_by: diesel_price
    entities:
      include: sensor.carburants*
    columns:
      - data: state
        icon: mdi:gas-station
        align: left
      - name: Diesel
        data: diesel_price
        align: center
      - name: Update
        data: diesel_date
        align: center
    css:
      tbody tr:nth-child(odd): 'background-color: rgba(255, 255, 255, 0.2)'
      tbody tr:nth-child(even): 'background-color: rgba(255, 255, 255, 0.1)'
      tbody tr:nth-child(1): 'color: #00ff00'
      tbody tr:nth-child(5): 'color: #FF0000'
    card_mod:
      style: |
        ha-card {
        border-radius: 10px;
        padding-bottom: 10px;
        background-color: rgba(0, 0, 0, 0.1)
        }
        :host {
        font-size: 13px;
        border-radius: 10px;
        }
  - type: divider
    style:
      height: 2px
      width: 100%
      margin-left: auto
      margin-right: auto
      background: rgba(255, 255, 255, 0.5)
  - type: custom:flex-table-card
    sort_by: sp95_price
    entities:
      include: sensor.carburants*
    columns:
      - data: state
        icon: mdi:gas-station
        align: left
      - name: SP95
        data: sp95_price
        align: center
      - name: Update
        data: sp95_date
        align: center
    css:
      tbody tr:nth-child(odd): 'background-color: rgba(255, 255, 255, 0.2)'
      tbody tr:nth-child(even): 'background-color: rgba(255, 255, 255, 0.1)'
      tbody tr:nth-child(1): 'color: #00ff00'
      tbody tr:nth-child(5): 'color: #FF0000'
    card_mod:
      style: |
        ha-card {
        border-radius: 10px;
        background-color: rgba(0, 0, 0, 0.1)
        }
        :host {
        font-size: 13px;
        border-radius: 10px;
        }

ET dans les log quelques erreur suite restart HA :

2022-06-27_11-09-10

2022-06-27_11-09-37

Il y a des coquilles dans tes sensors, tu n’as pas du sélectionner les bonnes colonnes partout => nth-of-type(XXXXX)


C’est en lien avec tes erreurs (carrefour par exemple)

Par exemple sur le carrefour herblay/Ste honorine, tu as 3 carburants

Mais dans ton template, tu cherches 1, 3, 4, 5

 - name: carburants_auchan_herblay
    resource: "https://carbu.com/france/index.php/station/auchan-supermarche/conflans-sainte-honorine/78700/18135"
    scan_interval: 3600
    sensor:
      - unique_id: carburants_auchan_herblay
        select: "[itemtype='http://data-vocabulary.org/Organization'] h1"
        value_template: "{{ value }}"
        attributes:
          - name: sp98_name
            select: ".col-xs-12:nth-of-type(1) h2"
          - name: sp98_price
            select: ".col-xs-12:nth-of-type(1) h1.price"
            value_template: "{{ value|replace(',','.') }}"
          - name: sp98_date
            select: ".col-xs-12:nth-of-type(1) p.sources"
            value_template: "{{ value.split(' ')[0] }}"
          - name: sp95_name
            select: ".col-xs-12:nth-of-type(3) h2.title"
          - name: sp95price
            select: ".col-xs-12:nth-of-type(3) h1"
            value_template: "{{ value|replace(',','.') }}"
          - name: sp95_date
            select: ".col-xs-12:nth-of-type(3) p.sources"
            value_template: "{{ value.split(' ')[0] }}"
          - name: e85_name
            select: ".col-xs-12:nth-of-type(4) h2"
          - name: e85_price
            select: ".col-xs-12:nth-of-type(4) h1"
            value_template: "{{ value|replace(',','.') }}"
          - name: e85_date
            select: ".col-xs-12:nth-of-type(4) p.sources"
            value_template: "{{ value.split(' ')[0] }}"
          - name: diesel_name
            select: ".col-xs-12:nth-of-type(5) h2"
          - name: diesel_price
            select: ".col-xs-12:nth-of-type(5) h1"
            value_template: "{{ value|replace(',','.') }}"
          - name: diesel_date
            select: ".col-xs-12:nth-of-type(5) p"
            value_template: "{{ value.split(' ')[0] }}"

Comme le dit @Pulpy c’est un problème de format de la colonne , j’ai eu le même soucis et @Herbs a donné une solution.
un exemple si tu as div:nth-of-type(3) h1 faudras mettre .col-xs-12:nth-of-type(3) h1

Dans le cas, de @barto_95, c’est le numéro qui coince div:nth-of-type(3) ça existe mais pas div:nth-of-type(4) ni div:nth-of-type(5) et en plus il faut faire gaffe au nom de l’attribut auquel on le rattache

Autant pour moi, j’avais pas fait gaffe a ce message. :innocent:

1 « J'aime »