Relaunching @edent_solar. Part 5 - Getting data out of Fronius Solarweb

Mostly notes to myself. My solar panels have an open API. But it's only available if I'm on the same network as the Fronius inverter. I can connect my system to so I can access it anywhere in the world - if I have the right password.

SolarWeb has an (optional) guest mode. You can view the panels' performance if you know the secret URl. It looks something like this:

Visiting that URl sets some cookies and then redirects you to something like this:

And the live performance data is at:

In order to make a request to the data URl, you need the cookies from the first URl. Here's some horrible PHP which will do just that.


$ch = curl_init();
//  Get the loging URl
curl_setopt($ch, CURLOPT_URL, "");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); //  It redirects
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

//  Store and use cookies
curl_setopt($ch, CURLOPT_COOKIEJAR,  '/tmp/cookies.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, '/tmp/cookies.txt');

//  Get the page

//  Find redirect URL
$redirect_url    = curl_getinfo($ch)["url"];
//  It is in the form
//  Get the System ID
$system_id_query = parse_url($redirect_url, PHP_URL_QUERY);
parse_str($system_id_query, $params);
$system_id = $params["pvSystemId"];

//  Finish up this request

//  2nd request
$ch = curl_init();
//  URl of the data
curl_setopt($ch, CURLOPT_URL, "{$system_id}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//  Use cookies
curl_setopt($ch, CURLOPT_COOKIEJAR,  '/tmp/cookies.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, '/tmp/cookies.txt');
$output = curl_exec($ch);

//  Output JSON
// header("Content-Type: application/json");
echo $output;
//  Clean up

And, hey presto, out pops a scrap of JSON:


4 thoughts on “Relaunching @edent_solar. Part 5 - Getting data out of Fronius Solarweb

  1. Dear Terence,

    I have 2 solar roofs with a total of 8 converters (to be all newly wired up on 21st of April 2020), 4 existing functioning solarweb / Solarlog, plus 4 new Fronius (new 2nd solar roof). Plus considering a first Tesla Powerwall 2.

    I would live to use your code to get more insight on a daily base, we also working on a plug for plug monitoring to link it all up within the house. my

    2 more guys from Berlin working also on it, both engineers like me. Would be appreciate if you get back.

    Best regards,

  2. Kaden says:

    Hi Terence,

    Do you know of a way to get the lifetime generation of the system programmatically? I can access it manually via -> Total (at the bottom of the chart), but I'm having trouble accessing it programmatically. Trying to replicate the POST request I find with Chrome DevTools leads to some anti-CRSF protections.

Leave a Reply

Your email address will not be published.

%d bloggers like this: