How to track Italian electricity prices

ottimo, allora abbandono la mia strada e uso quell’integrazione. grazie :slight_smile:

1 Like

Let me share for Turkish energy prices:

Water (for Istanbul): (in multiscrape.yaml)

- resource: https://www.iski.gov.tr/web/tr-TR/musteri-hizmetleri/su-birim-fiyatlari1
  scan_interval: 28800
  timeout: 15
  sensor:
    - unique_id: water_low_price
      name: Water Low Price
      unit_of_measurement: "TL/m3"
      icon: mdi-water
      select: "table > tbody > tr:nth-child(3) > td:nth-child(2) > p"
      value_template: '{{ value.split("\n\t\t\t\t\t")[1].replace(",",".") }}'
    - unique_id: water_high_price
      name: Water High Price
      unit_of_measurement: "TL/m3"
      icon: mdi-water
      select: "table > tbody > tr:nth-child(4) > td:nth-child(2) > p"
      value_template: '{{ value.split("\n\t\t\t\t\t")[1].replace(",",".") }}'

Electricity (all country across) (in multiscrape.yaml using multiscrape)

- resource: https://www.encazip.com/elektrik-fiyatlari
  scan_interval: 28800
  timeout: 15
  sensor:
    - unique_id: elk_aktif_enerji_dusuk_birim_fiyatı
      name: Elektrik Aktif Enerji Düsük Birim Fiyatı
      unit_of_measurement: "TL/kwh"
      icon: mdi-home-lightning-bolt
      select: ".content-table > tbody:nth-child(2) > tr:nth-child(1) > td:nth-child(2)"
      value_template: '{{ value.split(" TL/kWh")[0] }}'
    - unique_id: elk_aktif_enerji_yuksek_birim_fiyatı
      name: Elektrik Aktif Enerji Yüksek Birim Fiyatı
      unit_of_measurement: "TL/kwh"
      icon: mdi-home-lightning-bolt
      select: ".content-table > tbody:nth-child(2) > tr:nth-child(2) > td:nth-child(2)"
      value_template: '{{ value.split(" TL/kWh")[0] }}'
    - unique_id: elk_dagitim_bedeli_birim_fiyatı
      name: Elektrik Dağıtım Bedeli Birim Fiyatı
      unit_of_measurement: "TL/kwh"
      icon: mdi-home-lightning-bolt
      select: ".content-table > tbody:nth-child(2) > tr:nth-child(1) > td:nth-child(3)"
      value_template: '{{ value.split(" TL/kWh")[0] }}'

Gas ( for only igdas istanbul) (in sensor.yaml using rest)

make sure you enter your installation_number and contrat_number

- platform: rest
  resource_template: https://www.igdas.istanbul/WebServices/duzeltmekatsayisi.aspx?inst={installation_number}&contract={contrat_number}&date1={{(now()-timedelta(days=1)).strftime('%Y-%m-%d')}}&date2={{now().strftime('%Y-%m-%d')}}
  scan_interval: 3600
  name: Gaz Fiyatlar
  value_template: "Gas_Price"
  json_attributes:
    - UstIsilDeger
    - KFaktoru
    - OrtalamaBirimFiyat
    - ErrorCode

(Sorry for resuscitating an old thread :stuck_out_tongue: )

I’m using the integration and I really like it, but I have the need to pull the hourly PUN values to perform (through another add-on) some energy optimization.
So the multiscrape approach is what I needed and I found the example above really helpful.
If compared to that I’m using the XML approach as it allows me to easily query any day by relying on templates.
I’m pasting my solution here if anybody else needs it and linking the thread were I got some support on how to use the multiscrape (maybe there will be some evolution in the discussion and it may still be useful).

EDIT: I updated the resources to make the code work with the old GME site till 31st Dec.

multiscrape:
  - resource_template: 'https://storico.mercatoelettrico.org/It/WebServerDataStore/MGP_Prezzi/{{ as_timestamp(now()) | timestamp_custom("%Y%m%d", True) }}MGPPrezzi.xml'
    scan_interval: 3600
    parser: 'lxml'
    name: 'PUN oggi'
    button:
      unique_id: 'aggiorna_misure_pun_oggi'
      name: 'Aggiorna misure PUN oggi'
    log_response: true
    form_submit:
      submit_once: false
      resource: 'https://storico.mercatoelettrico.org/It/Tools/Accessodati.aspx'
      select: '#form1'
      input:
        'ctl00$ContentPlaceHolder1$CBAccetto1': 'on'
        'ctl00$ContentPlaceHolder1$CBAccetto2': 'on'
        'ctl00$ContentPlaceHolder1$Button1': 'Accetto'
      input_filter:
        - 'ctl00$ContentPlaceHolder1$Button2'
        - 'ctl00$vai'
        - 'ctl00$LinkButton2'
        - 'ctl00$LoginButton'
    sensor:
      - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(2) > PUN:nth-child(4)'
        name: 'PUN oggi 00'
        unique_id: 'pun_oggi_00'
        icon: 'mdi:currency-eur'
        unit_of_measurement: '€/kWh'
        value_template: '{{ value | replace (",", ".") |float | int / 1000}}'
      - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(3) > PUN:nth-child(4)'
        name: 'PUN oggi 01'
        unique_id: 'pun_oggi_01'
        icon: 'mdi:currency-eur'
        unit_of_measurement: '€/kWh'
        value_template: '{{ value | replace (",", ".") |float | int / 1000}}'

2 Likes

“I have a photovoltaic system, and I need to assess whether it’s worthwhile to consume the energy myself or feed it into the grid, especially if there will be very low prices the following day. Since the GME (Italian Wholesale Electricity Market) publishes the “Day-Ahead Market Prices (MGP)” around 1:00 PM, I would need to create sensors that fetch data for the next day like this:”

resource_template: 'https://www.mercatoelettrico.org/It/WebServerDataStore/MGP_Prezzi/{{ (as_timestamp(now()) + (24*3600)) | timestamp_custom("%Y%m%d", True) }}MGPPrezzi.xml'
# PUN RID TOMORROW
  - resource_template: 'https://www.mercatoelettrico.org/It/WebServerDataStore/MGP_Prezzi/{{ (as_timestamp(now()) + (24*3600)) | timestamp_custom("%Y%m%d", True) }}MGPPrezzi.xml'
    scan_interval: 3600
    parser: 'lxml'
    name: 'PUN Domani'
    button:
      unique_id: 'aggiorna_pun_domani'
      name: 'Aggiorna PUN domani'
    log_response: true
    form_submit:
      submit_once: false
      resource: 'https://www.mercatoelettrico.org/It/Tools/Accessodati.aspx'
      select: '#form1'
      input:
        'ctl00$ContentPlaceHolder1$CBAccetto1': 'on'
        'ctl00$ContentPlaceHolder1$CBAccetto2': 'on'
        'ctl00$ContentPlaceHolder1$Button1': 'Accetto'
      input_filter:
        - 'ctl00$ContentPlaceHolder1$Button2'
        - 'ctl00$vai'
        - 'ctl00$LinkButton2'
        - 'ctl00$LoginButton'
    sensor:
      - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(2) > PUN:nth-child(4)'
        name: 'PUN Domani Ora 00'
        unique_id: 'tomorr_energy_pun_0'
        icon: 'mdi:currency-eur'
        unit_of_measurement: '€/kWh'
        value_template: '{{ value | replace (",", ".") |float | int / 1000}}'
      - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(3) > PUN:nth-child(4)'
        name: 'PUN Domani Ora 01'
        unique_id: 'tomorr_energy_pun_1'
        icon: 'mdi:currency-eur'
        unit_of_measurement: '€/kWh'
        value_template: '{{ value | replace (",", ".") |float | int / 1000}}'
# create sensor for tomorrow RID hour Calabria
  - sensor:
      - name: "MGP PO Calabria Tomorrow"
        unit_of_measurement: "€/kWh"
        unique_id: energy_pun_tomorrow
        icon: mdi:currency-eur
        state: >
          {{ states('sensor.tomorr_energy_pun_' + (now().hour | string)) }}

Screenshot 2023-09-24 170746

ps. Today’s sensor code is the same as yours :slight_smile:

1 Like

If you need to optimize the charge/discharge cycle of your battery, depending on costs, load, PV prod and so on I would suggest you to give a try to this add-on, I’m already playing with:

For more details about how to use it you can have a look at this thread (not add-on specific but everything you see there is valid for it as well - if you use the add-on, of course):
https://community.home-assistant.io/t/emhass-an-energy-management-for-home-assistant/338126

Interesting, for the moment I’ve applied an average cost difference between buying and “ritiro dedicato (RID)” sales prices; I’ll have a look to see if it’s more precise and allows me to make this little step automatic.

GSE RID price is calculated in this way: the Hourly Zonal Price (PO), which is the price in the electricity market and depending on the time at which the energy is fed grid and the market zone in which the facility is located, so RID is multiplied by kWh fed to grid.
This in my HA:
1)

  # energy meter fed to grid hourly
  hourly_energy_grid_exported:
    source: sensor.grid_exported
    cycle: hourly
# RID Price zone Calabria
multiscrape:
  - resource_template: 'https://www.mercatoelettrico.org/It/WebServerDataStore/MGP_Prezzi/{{ as_timestamp(now()) | timestamp_custom("%Y%m%d", True) }}MGPPrezzi.xml'
    scan_interval: 3600
    parser: 'lxml'
    name: 'PUN oggi'
    button:

Nodered at xx:59:58 of every hour Every hour will multiply RID by kWh.

[{"id":"d8ccf8aecbf986ec","type":"tab","label":"Flow RID CALA","disabled":false,"info":"","env":[]},{"id":"0e6fc28155b6e376","type":"api-current-state","z":"d8ccf8aecbf986ec","name":"gmepo","server":"1c37c350.3f926d","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.mgp_pun_attuale","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"topic","propertyType":"msg","value":"input_1","valueType":"str"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":310,"y":40,"wires":[["df859bcd22d81e32"]]},{"id":"a12479a3c1d97fd0","type":"api-current-state","z":"d8ccf8aecbf986ec","name":"energy","server":"1c37c350.3f926d","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.hourly_energy_grid_exported","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"topic","propertyType":"msg","value":"input_2","valueType":"str"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":310,"y":140,"wires":[["df859bcd22d81e32"]]},{"id":"ed370677f6b728e9","type":"function","z":"d8ccf8aecbf986ec","name":"function 1","func":"msg.payload = (msg.payload.input_1 * msg.payload.input_2).toFixed(4);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":180,"wires":[["f76cebf3f1c4efb9","c153013cd9ecd1e4"]]},{"id":"f76cebf3f1c4efb9","type":"debug","z":"d8ccf8aecbf986ec","name":"debug 2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":640,"y":40,"wires":[]},{"id":"df859bcd22d81e32","type":"join","z":"d8ccf8aecbf986ec","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":470,"y":100,"wires":[["ed370677f6b728e9"]]},{"id":"c153013cd9ecd1e4","type":"ha-sensor","z":"d8ccf8aecbf986ec","name":"RIDCALA","entityConfig":"288828a3536cdefe","version":0,"state":"payload","stateType":"msg","attributes":[{"property":"last_update","value":"","valueType":"date"}],"inputOverride":"allow","outputProperties":[],"x":740,"y":120,"wires":[["43b86b7a647ad72f"]]},{"id":"43b86b7a647ad72f","type":"debug","z":"d8ccf8aecbf986ec","name":"debug 3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":900,"y":120,"wires":[]},{"id":"e76bf60247ce0fb0","type":"cronplus","z":"d8ccf8aecbf986ec","name":"Every 59min","outputField":"payload","timeZone":"","persistDynamic":false,"storeName":"","commandResponseMsgOutput":"output1","outputs":1,"options":[{"name":"schedule1","topic":"topic1","payloadType":"default","payload":"","expressionType":"cron","expression":"58 59 * * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}],"x":110,"y":60,"wires":[["a12479a3c1d97fd0","0e6fc28155b6e376"]]},{"id":"0be4d7a852d0df17","type":"inject","z":"d8ccf8aecbf986ec","name":"Test","props":[{"p":"debug","v":"true","vt":"bool"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":110,"y":200,"wires":[["0e6fc28155b6e376","a12479a3c1d97fd0"]]},{"id":"1c37c350.3f926d","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"id","deviceSelector":"id","entitySelector":"id","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true},{"id":"288828a3536cdefe","type":"ha-entity-config","server":"1c37c350.3f926d","deviceConfig":"3cf3d12d268fc427","name":"calcolo rid orario","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"calcolo rid orario"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"entity_picture","value":""},{"property":"device_class","value":"monetary"},{"property":"unit_of_measurement","value":"EUR"},{"property":"state_class","value":"measurement"}],"resend":false,"debugEnabled":false},{"id":"3cf3d12d268fc427","type":"ha-device-config","name":"calcolo rid orario","hwVersion":"","manufacturer":"Node-RED","model":"","swVersion":""}]

many thanks I will try this component :wink:

1 Like

I may be wrong but I fear it’s not just the Zonal Price, updated hour by hour and day by day, but it’s rather the average over the month, per zone, per band (now I remember why I applied an average delta using current PUN as a basis, instead of pulling from the XML).
Have a look here:

But please let me know if you have evidence/knowledge I’m wrong.

1 Like

In Italy we have 2 methods of compensating for energy fed to the grid:

  1. RID
  2. SSP

1. RID: PO x kWh fed to grid

I took my GSE RID contract as an example (the data was taken from the GSE website):

I took last invoice of august, year 2023:
kWh fed to grid: 307
Total payment by GSE: € 28,24 (VAT excl.) (the screenshot is for last august day: 31)

so, in GSE website i downloaded billing details:

as you can see for each day kWh fed to the grid is multiplied for PO price zone and every hour of every day matches PO GME price data (august, 31, 2023 PO Calabria in my example pictures)

On may 2023 I bought a Tesla Model 3 so energy fed to grid is very low :slight_smile: .

2. For SSP (Scambio Sul Posto) price calculation is quite different and a bit more complicated.

1 Like

I verified and you are right, but (at least for me) I think you may also need to consider the loss coefficient (coeff_perd = 1,052).
This is the formula I found in my detailed RID payments:

energia * coeff_perd * max(prz_ora;0)

where prz_ora is, as you said, the PUN of your geographic area.
If I sum the results of the formula, day by day, hour by hour, I get the amount I receive.

1 Like

Thank you both for the very useful inputs. I’ve successfully added the MULTISCRAPE integration from HACS and the code in configuration.yalm (see below).

Just one technical question: I’ve copied/pasted your code " - select: ‘NewDataSet:nth-child(1) > Prezzi:nth-child(2) > PUN:nth-child(4)’", I understood how to change the hour (increase the number after Prezzi:nth-child( ) , but how to change the zone? Currently all the values are the same, but maybe it will be different in the future…

Another question, why did you search for the day doc named of the day after? (as_timestamp(now()) + (24*3600) ) ?
Example: to calculate the price of the energy on at 00:30 on 29-01-2024 I should look in the document named 29-01-2024 and in the time range 1:

<Prezzi>
<Data>20240129</Data>
<Mercato>MGP</Mercato>
<Ora>1</Ora>
<PUN>75,110000</PUN>

Am I right?

Thank you again,
Andrea

-sensor:
# create sensor for tomorrow RID hour
  - platform: template
    sensors:
      mgp_po_tomorrow:
        friendly_name: "MGP PO tomorrow"
        unique_id: "MGP PO tomorrow"
        value_template: "{{ (states('sensor.tomorr_energy_pun_' + (now().hour | string))) }}"
        unit_of_measurement: €/kWh


multiscrape:
# PUN RID TOMORROW
  - resource_template: 'https://www.mercatoelettrico.org/It/WebServerDataStore/MGP_Prezzi/{{ (as_timestamp(now()) + (10)) | timestamp_custom("%Y%m%d", True) }}MGPPrezzi.xml'
    scan_interval: 3600
    parser: 'lxml'
    name: 'PUN Domani'
    button:
      unique_id: 'aggiorna_pun_domani'
      name: 'Aggiorna PUN domani'
    log_response: true
    form_submit:
      submit_once: false
      resource: 'https://www.mercatoelettrico.org/It/Tools/Accessodati.aspx'
      select: '#form1'
      input:
        'ctl00$ContentPlaceHolder1$CBAccetto1': 'on'
        'ctl00$ContentPlaceHolder1$CBAccetto2': 'on'
        'ctl00$ContentPlaceHolder1$Button1': 'Accetto'
      input_filter:
        - 'ctl00$ContentPlaceHolder1$Button2'
        - 'ctl00$vai'
        - 'ctl00$LinkButton2'
        - 'ctl00$LoginButton'
    sensor:
      - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(2) > PUN:nth-child(4)'
        name: 'PUN Domani Ora 00'
        unique_id: 'tomorr_energy_pun_0'
        icon: 'mdi:currency-eur'
        unit_of_measurement: '€/kWh'
        value_template: '{{ value | replace (",", ".") |float | int / 1000}}'
      - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(3) > PUN:nth-child(4)'
        name: 'PUN Domani Ora 01'
        unique_id: 'tomorr_energy_pun_1'
        icon: 'mdi:currency-eur'
        unit_of_measurement: '€/kWh'
        value_template: '{{ value | replace (",", ".") |float | int / 1000}}'
      - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(4) > PUN:nth-child(4)'
        name: 'PUN Domani Ora 02'
        unique_id: 'tomorr_energy_pun_2'
        icon: 'mdi:currency-eur'
        unit_of_measurement: '€/kWh'
        value_template: '{{ value | replace (",", ".") |float | int / 1000}}'

That’s the “tricky” part of multiscrape. You have to look into the CSS code to retrieve that; try to follow the instructions of the component here.
Once you find the right column you can select the rows by increasing the index (or inspect all of them - as you prefer).

You are right. We just needed tomorrow’s prices as well.

1 Like

@andrix I could replicate (I told you it’s tricky). Use Firefox:

1 Like

I need today’s and tomorrow’s prices for the RID in the Calabria area (for my PV, to calculate the price of the energy fed into the grid). Tomorrow’s prices are uploaded by the GME at 14:00 every day so I can visualize them on the dashboard 24 hours in advance. It’s a pity that the limitations of Home Assistant can’t create a sensor with future data and therefore I can’t represent them graphically, but to manage they are more than fine :slight_smile:


2

to scrape the hourly PUN instead I use this code (used for the energy purchased and not for the energy sold as the RID):

# MGP PUN Giornaliero
  - resource: "https://www.mercatoelettrico.org/it/default.aspx"
    name: PUN MGP Daily Average
    scan_interval: 3600
    log_response: true
    form_submit:
      submit_once: True
      resource: "https://www.mercatoelettrico.org/It/Tools/Accessodati.aspx?ReturnUrl=%2fIt%2fdefault.aspx"
      select: "#form1"
      input:
        "ctl00$ContentPlaceHolder1$CBAccetto1": "on"
        "ctl00$ContentPlaceHolder1$CBAccetto2": "on"
        "ctl00$ContentPlaceHolder1$Button1": "Accetto"
      input_filter:
        - "ctl00$ContentPlaceHolder1$Button2"
        - "ctl00$vai"
        - "ctl00$LinkButton2"
        - "ctl00$LoginButton"
    sensor:
      - select: "#ContentPlaceHolder1_lblMedia"
        name: "PUN INDEX daily average"
        unique_id: daily_pun_avg
        unit_of_measurement: "€/kWh"
        icon: mdi:transmission-tower-import
        device_class: monetary
        state_class: measurement
        value_template: '{{ (value | replace (",", ".") | float / 1000) | round(6) }}'
        on_error:
          value: last

3

and for the single-hour PUN on a monthly basis I use this (it is used to calculate the cost of the PUN on your bill if you have a single-hour rate):

multiscrape:
  # MGP PUN Mensile
  - resource: "https://www.mercatoelettrico.org/it/Statistiche/ME/DatiSintesi.aspx"
    name: PUN MPG
    scan_interval: 3600
    log_response: true
    form_submit:
      submit_once: True
      resource: "https://www.mercatoelettrico.org/It/Tools/Accessodati.aspx?ReturnUrl=%2fIt%2fStatistiche%2fME%2fDatiSintesi.aspx"
      select: "#form1"
      input:
        "ctl00$ContentPlaceHolder1$CBAccetto1": "on"
        "ctl00$ContentPlaceHolder1$CBAccetto2": "on"
        "ctl00$ContentPlaceHolder1$Button1": "Accetto"
      input_filter:
        - "ctl00$ContentPlaceHolder1$Button2"
        - "ctl00$vai"
        - "ctl00$LinkButton2"
        - "ctl00$LoginButton"
    sensor:
      - select: "#ContentPlaceHolder1_GridView2_lblMedia2_1"
        name: "January"
        unique_id: jan_pun_avg
        unit_of_measurement: "€/kWh"
        icon: mdi:transmission-tower-import
        device_class: monetary
        state_class: measurement
        value_template: '{{ (value | replace (",", ".") | float / 1000) | round(6) }}'
        on_error:
          value: last
      - select: "#ContentPlaceHolder1_GridView2_lblMedia2_2"
        name: "February"
        unique_id: feb_pun_avg
        unit_of_measurement: "€/kWh"
        icon: mdi:transmission-tower-import
        device_class: monetary
        state_class: measurement
        value_template: '{{ (value | replace (",", ".") | float / 1000) | round(6) }}'
        on_error:
          value: last
      - select: "#ContentPlaceHolder1_GridView2_lblMedia2_3"
        name: "March"
        unique_id: mar_pun_avg
        unit_of_measurement: "€/kWh"
        icon: mdi:transmission-tower-import
        device_class: monetary
        state_class: measurement
        value_template: '{{ (value | replace (",", ".") | float / 1000) | round(6) }}'
        on_error:
          value: last

4

just a heads-up that a new website was released for GME.
Unsure if the old one will be retired at some point but we may need to re-work our code to pull the data from the new one. :frowning:

@110hs , @MicheleMercuri , can you please share your entire code? :face_holding_back_tears: I’m trying to set both RID and “PUN per fasce” in order to calculate what I’m paying and what I’m earning.
I also saw some beautiful charts in your comments, can you share please the code for them too? I’m quite new on HA and a need lots example to get something yet :sweat_smile:

Thanks in advance

For PUN values I rely on the excellent https://github.com/virtualdj/pun_sensor
For “prezzi zonali” (I use Nord - you can find some details on how to select what you need in the previous posts), needed for RID calculations, please find below my code (I’m using Multiscrape integration).
But be informed that by end of December the “old” website of GME will be retired.
The new one has some differences and I’m almost sure my current approach won’t work anymore.
Also the integration I linked above is working to adapt to the new changes and I’m sitting on the fence, waiting to see if they will incorporate prezzi zonali as well (which seems not the case at the moment), if I will try to refactor their code to scan them or switch to ENTSO-E website that receives prezzi zonali from Terna and makes some API available to retrive them.

EDIT: I updated the resources to make the code work with the old GME site till 31st Dec.

- resource_template: 'https://storico.mercatoelettrico.org/It/WebServerDataStore/MGP_Prezzi/{{ as_timestamp(now()) | timestamp_custom("%Y%m%d", True) }}MGPPrezzi.xml'
  scan_interval: 900
  parser: 'lxml'
  name: 'Prezzo zonale oggi'
  button:
    unique_id: 'aggiorna_prezzo_zonale_oggi'
    name: 'Aggiorna Prezzo zonale oggi'
  log_response: true
  form_submit:
    submit_once: false
    resource: 'https://storico.mercatoelettrico.org/It/Tools/Accessodati.aspx'
    select: '#form1'
    input:
      'ctl00$ContentPlaceHolder1$CBAccetto1': 'on'
      'ctl00$ContentPlaceHolder1$CBAccetto2': 'on'
      'ctl00$ContentPlaceHolder1$Button1': 'Accetto'
    input_filter:
      - 'ctl00$ContentPlaceHolder1$Button2'
      - 'ctl00$vai'
      - 'ctl00$LinkButton2'
      - 'ctl00$LoginButton'
  sensor:
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(2) > NORD:nth-child(9)'
      name: 'Prezzo zonale oggi 00'
      unique_id: 'prezzo_zonale_oggi_00'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      attributes:
        - name: "start"
          value_template: '00:00:00'
        - name: "end"
          value_template: '00:59:59'
        - name: "device_class"
          value_template: 'monetary'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(3) > NORD:nth-child(9)'
      name: 'Prezzo zonale oggi 01'
      unique_id: 'prezzo_zonale_oggi_01'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      attributes:
        - name: "start"
          value_template: '01:00:00'
        - name: "end"
          value_template: '01:59:59'
        - name: "device_class"
          value_template: 'monetary'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(4) > NORD:nth-child(9)'
      name: 'Prezzo zonale oggi 02'
      unique_id: 'prezzo_zonale_oggi_02'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      attributes:
        - name: "start"
          value_template: '02:00:00'
        - name: "end"
          value_template: '02:59:59'
        - name: "device_class"
          value_template: 'monetary'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(5) > NORD:nth-child(9)'
      name: 'Prezzo zonale oggi 03'
      unique_id: 'prezzo_zonale_oggi_03'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      attributes:
        - name: "start"
          value_template: '03:00:00'
        - name: "end"
          value_template: '03:59:59'
        - name: "device_class"
          value_template: 'monetary'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(6) > NORD:nth-child(9)'
      name: 'Prezzo zonale oggi 04'
      unique_id: 'prezzo_zonale_oggi_04'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      attributes:
        - name: "start"
          value_template: '04:00:00'
        - name: "end"
          value_template: '04:59:59'
        - name: "device_class"
          value_template: 'monetary'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(7) > NORD:nth-child(9)'
      name: 'Prezzo zonale oggi 05'
      unique_id: 'prezzo_zonale_oggi_05'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      attributes:
        - name: "start"
          value_template: '05:00:00'
        - name: "end"
          value_template: '05:59:59'
        - name: "device_class"
          value_template: 'monetary'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(8) > NORD:nth-child(9)'
      name: 'Prezzo zonale oggi 06'
      unique_id: 'prezzo_zonale_oggi_06'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      attributes:
        - name: "start"
          value_template: '06:00:00'
        - name: "end"
          value_template: '06:59:59'
        - name: "device_class"
          value_template: 'monetary'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(9) > NORD:nth-child(9)'
      name: 'Prezzo zonale oggi 07'
      unique_id: 'prezzo_zonale_oggi_07'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      attributes:
        - name: "start"
          value_template: '07:00:00'
        - name: "end"
          value_template: '07:59:59'
        - name: "device_class"
          value_template: 'monetary'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(10) > NORD:nth-child(9)'
      name: 'Prezzo zonale oggi 08'
      unique_id: 'prezzo_zonale_oggi_08'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      attributes:
        - name: "start"
          value_template: '08:00:00'
        - name: "end"
          value_template: '08:59:59'
        - name: "device_class"
          value_template: 'monetary'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(11) > NORD:nth-child(9)'
      name: 'Prezzo zonale oggi 09'
      unique_id: 'prezzo_zonale_oggi_09'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      attributes:
        - name: "start"
          value_template: '09:00:00'
        - name: "end"
          value_template: '09:59:59'
        - name: "device_class"
          value_template: 'monetary'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(12) > NORD:nth-child(9)'
      name: 'Prezzo zonale oggi 10'
      unique_id: 'prezzo_zonale_oggi_10'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      attributes:
        - name: "start"
          value_template: '10:00:00'
        - name: "end"
          value_template: '10:59:59'
        - name: "device_class"
          value_template: 'monetary'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(13) > NORD:nth-child(9)'
      name: 'Prezzo zonale oggi 11'
      unique_id: 'prezzo_zonale_oggi_11'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      attributes:
        - name: "start"
          value_template: '11:00:00'
        - name: "end"
          value_template: '11:59:59'
        - name: "device_class"
          value_template: 'monetary'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(14) > NORD:nth-child(9)'
      name: 'Prezzo zonale oggi 12'
      unique_id: 'prezzo_zonale_oggi_12'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      attributes:
        - name: "start"
          value_template: '12:00:00'
        - name: "end"
          value_template: '12:59:59'
        - name: "device_class"
          value_template: 'monetary'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(15) > NORD:nth-child(9)'
      name: 'Prezzo zonale oggi 13'
      unique_id: 'prezzo_zonale_oggi_13'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      attributes:
        - name: "start"
          value_template: '13:00:00'
        - name: "end"
          value_template: '13:59:59'
        - name: "device_class"
          value_template: 'monetary'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(16) > NORD:nth-child(9)'
      name: 'Prezzo zonale oggi 14'
      unique_id: 'prezzo_zonale_oggi_14'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      attributes:
        - name: "start"
          value_template: '14:00:00'
        - name: "end"
          value_template: '14:59:59'
        - name: "device_class"
          value_template: 'monetary'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(17) > NORD:nth-child(9)'
      name: 'Prezzo zonale oggi 15'
      unique_id: 'prezzo_zonale_oggi_15'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      attributes:
        - name: "start"
          value_template: '15:00:00'
        - name: "end"
          value_template: '15:59:59'
        - name: "device_class"
          value_template: 'monetary'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(18) > NORD:nth-child(9)'
      name: 'Prezzo zonale oggi 16'
      unique_id: 'prezzo_zonale_oggi_16'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      attributes:
        - name: "start"
          value_template: '16:00:00'
        - name: "end"
          value_template: '16:59:59'
        - name: "device_class"
          value_template: 'monetary'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(19) > NORD:nth-child(9)'
      name: 'Prezzo zonale oggi 17'
      unique_id: 'prezzo_zonale_oggi_17'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      attributes:
        - name: "start"
          value_template: '17:00:00'
        - name: "end"
          value_template: '17:59:59'
        - name: "device_class"
          value_template: 'monetary'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(20) > NORD:nth-child(9)'
      name: 'Prezzo zonale oggi 18'
      unique_id: 'prezzo_zonale_oggi_18'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      attributes:
        - name: "start"
          value_template: '18:00:00'
        - name: "end"
          value_template: '18:59:59'
        - name: "device_class"
          value_template: 'monetary'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(21) > NORD:nth-child(9)'
      name: 'Prezzo zonale oggi 19'
      unique_id: 'prezzo_zonale_oggi_19'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      attributes:
        - name: "start"
          value_template: '19:00:00'
        - name: "end"
          value_template: '19:59:59'
        - name: "device_class"
          value_template: 'monetary'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(22) > NORD:nth-child(9)'
      name: 'Prezzo zonale oggi 20'
      unique_id: 'prezzo_zonale_oggi_20'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}' 
      attributes:
        - name: "start"
          value_template: '20:00:00'
        - name: "end"
          value_template: '20:59:59'
        - name: "device_class"
          value_template: 'monetary'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(23) > NORD:nth-child(9)'
      name: 'Prezzo zonale oggi 21'
      unique_id: 'prezzo_zonale_oggi_21'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}' 
      attributes:
        - name: "start"
          value_template: '21:00:00'
        - name: "end"
          value_template: '21:59:59'
        - name: "device_class"
          value_template: 'monetary'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(24) > NORD:nth-child(9)'
      name: 'Prezzo zonale oggi 22'
      unique_id: 'prezzo_zonale_oggi_22'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}' 
      attributes:
        - name: "start"
          value_template: '22:00:00'
        - name: "end"
          value_template: '22:59:59'
        - name: "device_class"
          value_template: 'monetary'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(25) > NORD:nth-child(9)'
      name: 'Prezzo zonale oggi 23'
      unique_id: 'prezzo_zonale_oggi_23'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}' 
      attributes:
        - name: "start"
          value_template: '23:00:00'
        - name: "end"
          value_template: '23:59:59'
        - name: "device_class"
          value_template: 'monetary'
      on_error:
        value: 'last'
        log: 'info'
      

- resource_template: 'https://www.mercatoelettrico.org/It/WebServerDataStore/MGP_Prezzi/{{ (as_timestamp(now()) + (24*3600))| timestamp_custom("%Y%m%d", True) }}MGPPrezzi.xml'
  scan_interval: 900
  parser: 'lxml'
  name: 'Prezzo zonale domani'
  button:
    unique_id: 'aggiorna_prezzo_zonale_domani'
    name: 'Aggiorna Prezzo zonale domani'
  log_response: true
  form_submit:
    submit_once: false
    resource: 'https://www.mercatoelettrico.org/It/Tools/Accessodati.aspx'
    select: '#form1'
    input:
      'ctl00$ContentPlaceHolder1$CBAccetto1': 'on'
      'ctl00$ContentPlaceHolder1$CBAccetto2': 'on'
      'ctl00$ContentPlaceHolder1$Button1': 'Accetto'
    input_filter:
      - 'ctl00$ContentPlaceHolder1$Button2'
      - 'ctl00$vai'
      - 'ctl00$LinkButton2'
      - 'ctl00$LoginButton'
  sensor:
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(2) > NORD:nth-child(9)'
      name: 'Prezzo zonale mscr domani 00'
      unique_id: 'prezzo_zonale_mscr_domani_00'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(3) > NORD:nth-child(9)'
      name: 'Prezzo zonale mscr domani 01'
      unique_id: 'prezzo_zonale_mscr_domani_01'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(4) > NORD:nth-child(9)'
      name: 'Prezzo zonale mscr domani 02'
      unique_id: 'prezzo_zonale_mscr_domani_02'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(5) > NORD:nth-child(9)'
      name: 'Prezzo zonale mscr domani 03'
      unique_id: 'prezzo_zonale_mscr_domani_03'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(6) > NORD:nth-child(9)'
      name: 'Prezzo zonale mscr domani 04'
      unique_id: 'prezzo_zonale_mscr_domani_04'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(7) > NORD:nth-child(9)'
      name: 'Prezzo zonale mscr domani 05'
      unique_id: 'prezzo_zonale_mscr_domani_05'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(8) > NORD:nth-child(9)'
      name: 'Prezzo zonale mscr domani 06'
      unique_id: 'prezzo_zonale_mscr_domani_06'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(9) > NORD:nth-child(9)'
      name: 'Prezzo zonale mscr domani 07'
      unique_id: 'prezzo_zonale_mscr_domani_07'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(10) > NORD:nth-child(9)'
      name: 'Prezzo zonale mscr domani 08'
      unique_id: 'prezzo_zonale_mscr_domani_08'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(11) > NORD:nth-child(9)'
      name: 'Prezzo zonale mscr domani 09'
      unique_id: 'prezzo_zonale_mscr_domani_09'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(12) > NORD:nth-child(9)'
      name: 'Prezzo zonale mscr domani 10'
      unique_id: 'prezzo_zonale_mscr_domani_10'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(13) > NORD:nth-child(9)'
      name: 'Prezzo zonale mscr domani 11'
      unique_id: 'prezzo_zonale_mscr_domani_11'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(14) > NORD:nth-child(9)'
      name: 'Prezzo zonale mscr domani 12'
      unique_id: 'prezzo_zonale_mscr_domani_12'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(15) > NORD:nth-child(9)'
      name: 'Prezzo zonale mscr domani 13'
      unique_id: 'prezzo_zonale_mscr_domani_13'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(16) > NORD:nth-child(9)'
      name: 'Prezzo zonale mscr domani 14'
      unique_id: 'prezzo_zonale_mscr_domani_14'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(17) > NORD:nth-child(9)'
      name: 'Prezzo zonale mscr domani 15'
      unique_id: 'prezzo_zonale_mscr_domani_15'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(18) > NORD:nth-child(9)'
      name: 'Prezzo zonale mscr domani 16'
      unique_id: 'prezzo_zonale_mscr_domani_16'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(19) > NORD:nth-child(9)'
      name: 'Prezzo zonale mscr domani 17'
      unique_id: 'prezzo_zonale_mscr_domani_17'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(20) > NORD:nth-child(9)'
      name: 'Prezzo zonale mscr domani 18'
      unique_id: 'prezzo_zonale_mscr_domani_18'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(21) > NORD:nth-child(9)'
      name: 'Prezzo zonale mscr domani 19'
      unique_id: 'prezzo_zonale_mscr_domani_19'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}'
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(22) > NORD:nth-child(9)'
      name: 'Prezzo zonale mscr domani 20'
      unique_id: 'prezzo_zonale_mscr_domani_20'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}' 
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(23) > NORD:nth-child(9)'
      name: 'Prezzo zonale mscr domani 21'
      unique_id: 'prezzo_zonale_mscr_domani_21'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}' 
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(24) > NORD:nth-child(9)'
      name: 'Prezzo zonale mscr domani 22'
      unique_id: 'prezzo_zonale_mscr_domani_22'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}' 
      on_error:
        value: 'last'
        log: 'info'
    - select: 'NewDataSet:nth-child(1) > Prezzi:nth-child(25) > NORD:nth-child(9)'
      name: 'Prezzo zonale mscr domani 23'
      unique_id: 'prezzo_zonale_mscr_domani_23'
      icon: 'mdi:currency-eur'
      unit_of_measurement: '€/kWh'
      value_template: '{{ value | replace (",", ".") | float | int / 1000 }}' 
      on_error:
        value: 'last'
        log: 'info'
1 Like

Hi, your multiscrape configuration is running now?
I have some problems and can’t read hour values of PUN.

I guess you have to update the resources to https://storico.mercatoelettrico.org.
This workaround will work till 31st Dec; see below.
https://www.mercatoelettrico.org/it-it/Home/MediaGME/ArchivioNews?id=6350

Sharing with the community that already exists a custom component that pulls the data from ENTSO-E portal, prezzi zonali for today and tomorrow (you have to look in the attributes of sensor average_electricity_price:

https://github.com/JaccoR/hass-entso-e/

Good morning, Help me, until September this site worked and also the script, apparently nothing has changed but since October it doesn’t work anymore, I’ve been banging my head against it for a few days, can someone help me?

- name: PSV Mensile
  resource: "https://www.brokerperlenergia.it/psv/"
  method: 'GET'
  scan_interval: 86400

  sensor:
  - select: ".table > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(2) > td:nth-child(2) > strong:nth-child(1)"
    name: 'PSV GAS Mensile'
    unique_id: 'psv_gas_mensile'
    icon: 'mdi:currency-eur'
    unit_of_measurement: '€/Smc'
    value_template: '{{ value | replace (",", ".") | float(0)| round(6) }}'
    force_update: true