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

Le champ state contient le nom qui effectivement est récupérer des infos issues de la page web. Tu peux ajouter les noms à la main/ en dur si tu veux

xxxxx
value_template: "Ici mon nom à moi en dur"
xxxxxx

Avec les premières versions et la carte flex-table-card tu pourrais (mais du coup sans les couleurs rouge/verte)
Maintenant avec plusieurs carburants, c’est pas terrible je trouve, parce que le moins cher du SP95 c’est pas forcement le même que le moins cher de l’E10.
Par contre tu peux changer la couleur rouge/verte par ce que tu veux green/B90000

            {% if price==prices.minima[k] -%}
              {{ '<font color=green>'+price+'</font>' }}
            {% elif  price==prices.maxima[k] -%}
              {{ '<font color=#B90000>'+price+'</font>' }}
            {% else -%}
              {{price}}
            {% endif -%}
1 « J'aime »

Merci @Pulpy-Luke !
C’est top !

Est-ce qu’on peut transformer cette ligne :

{{ '<font color=#32CD32>'+price+'</font>' }}

pour que le prix s’affiche en gras ?

Et dernière question, je n’ai pas de date pour carrefour Chalon Nord car ils ne proposent pas le E10. J’ai vu dans le code que la date se basait sur le E10.

<td>{{ state_attr(carburants_entity, 'e10_date') }}</td>

Est-il possible de mentionner que si pas dispo en E10 alors se référer au sp95 ?

tu peux adapter en faisant
{{ '<font color=#32CD32><b>'+price+'</b></font>' }}

Non (peut être mais j’ai pas testé), mais si tu as du SP95 partout, tu peux te baser sur info à la place => sp95_date

1 « J'aime »

Je rebondis là dessus, il y a peut-être un moyen.
Par contre, quand on a plusieurs carburants et plusieurs dates je vais devoir prendre la plus récente

@Hankey71
Si tu veux tester …

  • Ajout des variables colormin/colormax pour simplifier la personnalisation (au format texte)
  • Ajout de la mise en gras min/max
  • Récupération de la date la plus récente parmi les dates de màj des carburants de la station
{%- set items = {1:'e10', 0:'sp98', 2:'gpl'} -%}
{%- set colormin = 'green' -%}
{%- set colormax = 'red' -%}
{%- set prices = namespace(minima=[],maxima=[],update='') -%}
{%- for i in range(items|length) -%}
  {%- set tmp = expand('group.carburants')
      |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') | map(attribute='entity_id')|list -%}
<table><thead><tr> <th colspan="2">Station</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><img src="{{state_attr(carburants_entity, 'entity_picture')}}" height="20"> </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+'><b>'+price+'</b></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>
1 « J'aime »

Merci @Pulpy-Luke !

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 :

2 « J'aime »

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

@Pulpy-Luke 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-Luke !!! 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