Salut @Pbranly
Voici le code multiscrape pour récupérer les infos depuis le site web :
multiscrape:
- name: carburants_feillens
resource: "https://carbu.com/france/index.php/station/intermarche/feillens/01570/16195"
scan_interval: 3600
sensor:
- unique_id: carburants_feillens
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
resource: "https://carbu.com/france/index.php/station/auchan/macon/71000/6438"
scan_interval: 3600
sensor:
- unique_id: carburants_auchan
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"
- name: sp95_e10_price
select: ".col-xs-12:nth-of-type(3) h1.price"
value_template: "{{ value|replace(',','.') }}"
- name: sp95_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(5) h2"
- name: gpl_price
select: ".col-xs-12:nth-of-type(5) h1"
value_template: "{{ value|replace(',','.') }}"
- name: gpl_date
select: ".col-xs-12:nth-of-type(5) p"
value_template: "{{ value.split(' ')[0] }}"
- name: diesel_name
select: ".col-xs-12:nth-of-type(4) h2"
- name: diesel_price
select: ".col-xs-12:nth-of-type(4) h1"
value_template: "{{ value|replace(',','.') }}"
- name: diesel_date
select: ".col-xs-12:nth-of-type(4) p.sources"
value_template: "{{ value.split(' ')[0] }}"
- name: carburants_bien
resource: "https://carbu.com/france/index.php/station/atac/saint-benigne/01190/12119"
scan_interval: 3600
sensor:
- unique_id: carburants_bien
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(2) h2"
- name: sp95_e10_price
select: ".col-xs-12:nth-of-type(2) h1"
value_template: "{{ value|replace(',','.') }}"
- name: sp95_e10_date
select: ".col-xs-12:nth-of-type(2) p"
value_template: "{{ value.split(' ')[0] }}"
- name: diesel_name
select: ".col-xs-12:nth-of-type(4) h2"
- name: diesel_price
select: ".col-xs-12:nth-of-type(4) h1"
value_template: "{{ value|replace(',','.') }}"
- name: diesel_date
select: ".col-xs-12:nth-of-type(4) p.sources"
value_template: "{{ value.split(' ')[0] }}"
- name: carburants_replonges
resource: "https://carbu.com/france/index.php/station/intermarche/replonges/01750/12321"
scan_interval: 3600
sensor:
- unique_id: carburants_replonges
select: "[itemtype='http://data-vocabulary.org/Organization'] h1"
value_template: "{{ value }}"
attributes:
- name: sp95_e5_name
select: ".col-xs-12:nth-of-type(2) h2"
- name: sp95_e5_price
select: ".col-xs-12:nth-of-type(2) h1"
value_template: "{{ value|replace(',','.') }}"
- name: sp95_e5_date
select: ".col-xs-12:nth-of-type(2) p"
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: diesel_name
select: ".col-xs-12:nth-of-type(4) h2"
- name: diesel_price
select: ".col-xs-12:nth-of-type(4) h1"
value_template: "{{ value|replace(',','.') }}"
- name: diesel_date
select: ".col-xs-12:nth-of-type(4) p.sources"
value_template: "{{ value.split(' ')[0] }}"
- name: carburants_fleurville
resource: "https://carbu.com/france/index.php/station/total-access/fleurville/71260/10173"
scan_interval: 3600
sensor:
- unique_id: carburants_fleureville
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] }}"
*à modifier suivant ta ville
Voici le code pour la 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.dalg_nas
image: /local/images/essence.jpg
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 voici l’image de la pompe à copier dans le dossier www/image