Download data from pvoutput.org

Is it possible to download one year worth of data from pvouout.org?

I am developing an app that analyses production within a day and by season but my system was only installed recently so I am looking for a way to get a full year worth of 5-min interval data for any system.

Any volunteers or suggestions on how to get that would be greatly appreciated :slight_smile:

See https://pvoutput.org/help.html#api-getstatus

Hello Gaetano, did you manage to understand if it’s possible to download the data? I ask because I would also need a yearly data of a whatever plant for an university project and this website seemed interesting, but I can’t understand how (if) I can download the generation data…

Sorry for the late reply. The notifications go to my junk folder…

I haven’t tried but from the link posted by bankstownbloke, if you donate $15 to pvoutput.org, you have access specifying a siteID of any system in a GET request to the server and you can access data that is archived (older than 6 months). After making the donation, it seems that entering the following URL in your browser would return the detailed 5-minute data for an entire day

https://pvoutput.org/service/r2/getstatus.jsp?sid=“any system id”&key=“your API key”&h=1&d=“YYYYMMDD”

Replace the contents in-between the double-quotes with the actual value and remove the quotes too.

With some programming skills, you can automate those requests to get this data for an entire year without entering 365 times that URL with a different date.

Hope that helps.
Gaetano.

Hi @Gaetano, I am trying to download data for an example system. However, my API key works only with my system ID (I have created a generation only system). For all the other systems, it gives invalid API error. I have made the donation so there should be no problem on that front. Can you please confirm that you can download data for any system using your API key? I need to download data for my research project.

Use the sid1 parameter, the request should be -

  • getstatus.jsp?&sid=(your_system_id)&key=(your_api_key)&sid1=(system_id_to_query)

@nomanbashir Sorry for the late reply. I am not getting notifications for some reason. I have only tried on my API key but to do it on other systems, you must make a donation to pvoutput.org

slight correction to the url structure, you need both a sid (your system id) and sid1 (the target system id - you can find it in the address bar of your browser when looking at live data for any system):

https://pvoutput.org/service/r2/getstatus.jsp?sid=&sid1=&key=&h=1&d=

no quotes (or anything) is needed to delimit values. I just tried and it works on a system other than mine.

It’s more complicated than that:

you do need sid1, but you also need to specify the h=1 parameter and the “from” and “to” times and the limit=100 else you only get the last 30 records posted for the day.

So here is the way to go, knowing that intervals are 5-minutes and 100 records equals 100*5 = 500 mins = 8.33 hours, you need 3 requests to get a full day worth of data:

https://pvoutput.org/service/r2/getstatus.jsp?sid=&sid1=&key=&h=1&limit=100&from=00:00&to=07:55&d=

then replace the time bracket with from=08:00&to=15:55 and from=16:00&to=23:55 for the other two requests.

If the whole day is required then h=1&limit=288 is sufficient.

There is no need to make multiple requests or use from/to ranges.

Hi bankstownbloke

I am trying to download yesterday’s data as a CSV file using the following python code (extract)

url = 'https://pvoutput.org/service/r2/getstatus.jsp'
headers = {
    'X-Pvoutput-SystemId': ID,
    'X-Pvoutput-Apikey': API
}
params = {
    'd': DATE,
    'h': HISTORY,
    'limit': LIMIT,
    'ext': EXTENDED_DATA
}

print(url, headers, params)

response = requests.get(url, headers=headers, data=params)
print(response.text)

The response is the last live data from today not 288 lines from yesterday. It is working because I can see it is my data. I think that the params are not being passed as it only returns the latest 5 minute data. I have following params {‘d’: ‘20210402’, ‘h’: 1, ‘limit’: 288, ‘ext’: 1}

Any help with the syntax?

Thanks

Best to test by entering in a browser, otherwise its an issue with the python code.

Hi bankstownbloke

I found a solution but I am not sure why. If I use POST rather than GET it works. I suspect it has something to do the requests library and the difference between how the GET and POST requests are handled. It appears that the GET is not sending the parameters as expected by the API. Not sure it you process the GET and POST calls the same.

Another issue I am seeing now is that there is a difference between sending daily updates using the web page Add Output CSV Loader function with the following data sample

9/04/2021,36449.08333,22548.25,13079.16667

This represents DATE,GENERATED,EXPORTED,USED

When I do the same using python as a POST

url = 'https://pvoutput.org/service/r2/addoutput.jsp'
headers = {
    'X-Pvoutput-SystemId': ID,
    'X-Pvoutput-Apikey': API
}
params = {
    'd': DATE,
    'g': GENERATION,
    'e': EXPORT,
    'c': CONSUMPTION
}

resp = requests.post(url, headers=headers, data=params, timeout=10)

The difference is that when I do it via the website the $ balance for the day is updated but when I do it via the POST it is not. I want it to update.

I was thinking to using the curl command and send it via a subprocess call to see if it makes a difference.

Any ideas with this one?

Thanks David

The result from either POST or GET should be identical.

The GET request expects sid and key while the POST expects X-Pvoutput-SystemId and X-Pvoutput-ApiKey. The code above would only work with POST.