Onestamente no, non ti seguo.
Sicuramente avrai un buon motivo per acquisire tutte le medie mensili passate (per curiosità chiedo: quale motivo?).
Peró la media corrente che vedo io è esattamente quella del sito che hai riportato tu.
Hai spuntato la casella in fase di configurazione?
Cito la pagina del dev:
Se la casella di controllo Usa solo dati reali ad inizio mese è attivata all’inizio del mese quando non ci sono i prezzi per tutte le fasce orarie questi vengono disabilitati (non viene mostrato quindi un prezzo in €/kWh finché i dati non sono sufficiente); nel caso invece la casella fosse disattivata (default) nel conteggio vengono inclusi gli ultimi giorni del mese precedente in modo da avere sempre un valore in €/kWh.
Il motivo che mi son preso tutti i mesi è per il semplice fatto che una volta che ho capito come fare ,me li sono portati tutti in HA, e poi li mi sarà più facile gestirli.
In realtà a me ne basterebbero due… O addirittura uno, ma non saprei come far cambiare la lettura al cambio mese.
Tipo adesso a me interessa avere la media di giugno (che ovviamente è parziale) per avere un idea di come sta andando il mercato , e la media di maggio per calcolare i costi del mese appena passato.
No, quella casella non ho provato a spuntarla… Questa sera ci provo.
A te escono esattamente le medie della mia pagina?
Confermo che una volta spuntata quella casella sia l’altro giono che oggi il sensore “sensor.pun_mono_orario” mi da lo stesso valore che leggo per il mese di Giugno alla pagina https://www.mercatoelettrico.org/It/Statistiche/ME/DatiSintesi.aspx
Stessi valori fino all’ultimo decimale.
Per il fatto di avere il valore del mese precedente, forse si riesce a farlo semplicemente con un helper…ma non c’ho ancora pensato…
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.
“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:”
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:
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
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:
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)
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.
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:
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.
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
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.
@110hs , @MicheleMercuri , can you please share your entire code? 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
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.