Python Script to Retrieve SolarEdge Solar Panel Data

Written by

in

,

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.

Comments

4 responses to “Python Script to Retrieve SolarEdge Solar Panel Data”

  1. Jan Pieters Avatar
    Jan Pieters

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

    1. Sam Avatar
      Sam

      It’s this one: https://pypi.org/project/solaredge/ . 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).

  2. Brian Avatar
    Brian

    Did they take away the ability for a homeowner to create an API? I don’t see it anywhere.

    Furthermore, on https://developers.solaredge.com, they say Monitoring API (v1) is being deprecated on October 1, 2026. Do all of these efforts expire?

    1. Sam Avatar

      Whoa, thanks for pointing this out Brian! https://api-docs.solaredge.com/ indeed makes it look like that v1 API is going away. I use the SolarEdge API a little bit at work and will try to find out from a contractor what’s happening there.

Leave a Reply

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