Data analysis How-to

Python Script to Retrieve SolarEdge Solar Panel Data

After having a rooftop solar array installed on my home in 2019, I wanted to analyze its actual performance and compare it to projections. In particular, we ended up with a smaller inverter (7kW) than recommended for our total panel capacity (11kW). We often experience some shading on our panels, so the inverter should not limit (or “clip”) the energy production too greatly – but I want to quantify the extent of the clipping effect.

That analysis is for later, though. Here is how I first retrieved the production data for my system from the SolarEdge API, in fifteen-minute intervals. It pulls data for both energy (watt-hours generated) and power (power production, in watts). I think the power is average power over that 15 minute period, though I don’t see that documented and it doesn’t line up exactly with energy generation. I’m a Python beginner and relied on my brother, who kindly wrote almost all of this code.

Setup: you’ll need your SolarEdge API key, which you can get by following their instructions (pp. 5-6). You’ll also need to install the solaredge Python package (and Python itself, if you haven’t used it before). In addition to an API key, the script below refers to a site ID. You can find that in the mySolarEdge app, under information about your site, or via the results of a query to the API.

The Script

After getting burned by embedding code using a WordPress plugin that didn’t transfer well to my new webhost, I’ve put the code in a GitHub repository and embedded the script here:

VoilĂ ! Now we have a .csv written to disk with a year (or whatever range you specified) of system performance data at fifteen-minute intervals. Feel free to send pull request improvements or fork for your own usage.

I am an expert R programmer and a Python rookie. However, there was already a wrapper package in Python for accessing the SolarEdge API, and I found no such package for R. So the quickest way for me to answer the questions I have about clipping was to grab the data via Python, write it to .csv, and then conduct the analysis in R where I’m much more comfortable. When I get to that – and write it up – it’ll be a new post.

2 replies on “Python Script to Retrieve SolarEdge Solar Panel Data”

In the script there is an import for solaredge. Which one is that and where can it be found?

It’s this one: . It can be installed with pip install solaredge.

Note that the code on the project’s GitHub repository is obsolete, there seems to be a new maintainer and the code on pypi is newer (which is more convenient than the other way around).

Leave a Reply

Your email address will not be published. Required fields are marked *