zinen / node-red-contrib-nordpool-api-plus

7 stars 5 forks source link

Nordpool API have changed #29

Open Teme-V opened 3 weeks ago

Teme-V commented 3 weeks ago

Looks a like Nordpool have shutdown their old API and node can't pull prices anymore Here is an example of new API : https://dataportal-api.nordpoolgroup.com/api/DayAheadPrices?date=2024-10-08&market=DayAhead&deliveryArea=AT,BE,FR,GER,NL,PL,NO1,FI,SYS&currency=EUR

https://data.nordpoolgroup.com/auction/day-ahead/prices?deliveryDate=latest&currency=EUR&aggregation=Hourly&deliveryAreas=AT,BE,FR,GER,NL,PL,NO1,FI,SYS

qabi commented 3 weeks ago

Looks like there is a dependency to package "nordpool" (v. 3.0.0). But this package is scraping old URLs, and not planning to to use new endpoints. I think it is necessary to fetch above API URLs directly from this node in the future.

shatreyman commented 3 weeks ago

Any solution? What to do?

qabi commented 3 weeks ago

Any solution? What to do?

I just made a simple http request in my flow, instead. It took 10 minutes. The data is a bit different, but easy enough to map.

https://pastebin.com/NpikqtXk

zinen commented 3 weeks ago

Thanks for shareing @qabi - nice fix!

The issue is found in the dependent module also https://github.com/samuelmr/nordpool-node/issues/27 but if the fix is this easy I might just roll @qabi's fix inside this node. I'll look at this later

ektoekto commented 3 weeks ago

Here are easy one line consts for these:

const urlToday = "https://dataportal-api.nordpoolgroup.com/api/DayAheadPrices?market=DayAhead&deliveryArea=FI&currency=EUR&date=" + new Date().toISOString().split('T')[0];

const urlTomorrow = "https://dataportal-api.nordpoolgroup.com/api/DayAheadPrices?market=DayAhead&deliveryArea=FI&currency=EUR&date=" + new Date(new Date().setDate(new Date().getDate() + 1)).toISOString().split('T')[0];

Then just put a http node infront that returns a parsed JSON object.

kamakaze commented 3 weeks ago

it works for me when I just changed old url from /node_modules/nordpool/config.js file: var baseUrl = 'http://www.nordpoolgroup.com/api' then old api works in new address.

Naturally you have to restart node-red after this.

SargonofAssyria commented 3 weeks ago

Tnx, That works for me too.

zinen commented 3 weeks ago

Should be fixed as of version 4.5.3 - using @qabi's approach

salmitk commented 3 weeks ago

Something strange here. Updated to version 4.5.3. Current date 2024.10.10. Response from Nordpool node "No data found for 2024-10-12" Setting is "Price for yesterday, today and tomorrow".

If I check only price for tomorrow, then the response is "2024-10-11 OK"

Lumevana commented 3 weeks ago

Something is wrong with latest version. If setting is "Price for yesterday, today and tomorrow" then there is no data for tomorrow.

derrij commented 2 weeks ago

commented out the second and third date = new Date() and everything seemed to work https://pastebin.com/1xHvuqXk

prj commented 2 weeks ago

commented out the second and third date = new Date() and everything seemed to work https://pastebin.com/1xHvuqXk

Works for me. Otherwise it thinks "tomorrow" means "the day after tomorrow" and of course that fails.