Push Fronius log data from the past into PV Output?

My PVOutput Premium account lapsed which means log data was not being sent to PVOutput and I now have 20 days of inaccurate data. Is there a way I can get the Fronius to push the previous 20 days into PVOutput?

Sadly, the inverter itself doesn’t keep stats that long. You could connect up to Solarweb, pull down the 20 days of history from there, and hand-create a CSV in the right format for uploading into PVO using the ‘CSV Loader’ at the bottom of the Add Output tab (https://pvoutput.org/addoutput.jsp). Or just use the Add Output page 20 times manually to backfill the information. 20 days is better than 200 days :slight_smile:

Hi cousinlarry,

Depending on the model of your Fronius inverter you can retrieve historic data from the inverter’s memory. I can access nearly a year’s worth of data from my Symo 5.0-3-M.

The specifc Fronius API Call is:

http://fronius/solar_api/v1/GetArchiveData.cgi?Scope=System&StartDate=9.3.2020&EndDate=9.3.2020&Channel=Temperature_Channel_1&Channel=Temperature_Channel_2&Channel=Temperature_Powerstage

You would need to amend the StartDate & EndData to select your specific range. You MUST use a date format specified in the Fronius API documentation.

The Fronius documentation can be found here:

The fields that you require are described in the documentation starting at page 52

You would need to covert the output into a CSV format in order to upload it to PVO.

Good Luck.

I thought the datacard had enough memory for many years of data storage for a typical residential set up.

Hi,

The following hastily cobbled together PHP code should extract the data you require. The code produces a CSV output which you can redirect into a TEXT file.

The code extracts both PRODUCTION and CONSUMPTION figures although clearly you can only get CONSUMPTION data if you have a meter attached to your inverter - I do.

To extract data for days other than today you will need to override $date AND $time otherwise it will default to NOW. So if you wish to extract yesterday’s data change the date to “2020-03-25” and the time to “23:59”.

If you plan on uploading the data using the PVO GUI Add Output >> Live Loader you need to specify the order of the columns AND importantly that the Energy Values are ‘Daily Cumulative’. You will also need to run an extract for every day that you are missing data.

<?php

$dataManagerIP = "fronius";							
	
$country = "Australia";
$capitalCity ="Perth";

date_default_timezone_set("$country/$capitalCity");

$date = date('Y-m-d', time());
$pushDate = date('Ymd', time());

// Overide Date for Manual Extract
// $date = "2019-03-05";

$time = date('H:i', time());

// Overide Time for Manual Extract
// $time = "18:45";

$inverterDataURL = "http://".$dataManagerIP."/solar_api/v1/GetArchiveData.cgi?Scope=System&StartDate=".$date."&EndDate=".$date."&Channel=EnergyReal_WAC_Sum_Produced&Channel=EnergyReal_WAC_Minus_Absolute&Channel=EnergyReal_WAC_Plus_Absolute&Channel=PowerReal_PAC_Sum";
$inverterJSON = file_get_contents($inverterDataURL);
$arr = json_decode($inverterJSON, true);

$x = 0;

$EnergyReal_WAC_Sum_Cumulative = 0;

while ( $x < 86400 && gmdate("H:i", $x) <= $time )
	{
   	$EnergyReal_WAC_Sum_Produced = $arr["Body"]["Data"]["inverter/1"]["Data"]["EnergyReal_WAC_Sum_Produced"]["Values"][$x];
	$EnergyReal_WAC_Minus_Absolute = $arr["Body"]["Data"]["meter:17380299"]["Data"]["EnergyReal_WAC_Minus_Absolute"]["Values"][$x];
	$EnergyReal_WAC_Plus_Absolute = $arr["Body"]["Data"]["meter:17380299"]["Data"]["EnergyReal_WAC_Plus_Absolute"]["Values"][$x];
	$PowerReal_PAC_Sum = $arr["Body"]["Data"]["inverter/1"]["Data"]["PowerReal_PAC_Sum"]["Values"][$x];
	$EnergyReal_WAC_Sum_Cumulative += $EnergyReal_WAC_Sum_Produced;
	
	if ( $x == 0 ) 
		{
		$startMinus = $EnergyReal_WAC_Minus_Absolute;
		$startPlus =  $EnergyReal_WAC_Plus_Absolute;
		}	
	
	$deltaMinus = $EnergyReal_WAC_Minus_Absolute - $startMinus;
	$deltaPlus = $EnergyReal_WAC_Plus_Absolute - $startPlus;
	
	$consumed = $deltaPlus - $deltaMinus + $EnergyReal_WAC_Sum_Cumulative;
	
	$time_value = gmdate("H:i", $x);
	
    echo gmdate("H:i", $x) . "," . $EnergyReal_WAC_Sum_Cumulative . "," . $PowerReal_PAC_Sum . "," . $consumed . "\n";
                
	$x += 300;
	
	}

?>

All,

I have had the opportunity to test the PHP code against another Fronius inverter. The script will fail because I’ve discovered that two of the functions used to extract the meter data have ( my ) embedded meter’s serial number 17380299.

$EnergyReal_WAC_Minus_Absolute = $arr[“Body”][“Data”][“meter:17380299”][“Data”][“EnergyReal_WAC_Minus_Absolute”][“Values”][$x];
$EnergyReal_WAC_Plus_Absolute = $arr[“Body”][“Data”][“meter:17380299”][“Data”][“EnergyReal_WAC_Plus_Absolute”][“Values”][$x];

The easy fix is to substitute your meter’s serial number. It can be obtained by visiting:

http://fronis/solar_api/v1/GetArchiveData.cgi?Scope=System&StartDate=10.3.2020&EndDate=10.3.2020&Channel=EnergyReal_WAC_Plus_Absolute

Where ‘fronius’ will resolve to the IP address of your inverter. Simply amend the two lines of PHP code to use your meter’s serial number.

All being well it should return some data which includes the meter’s serial number.

{
	"Body" : 
	{
		"Data" : 
		{
			"meter:**17380299**" : 
			{
				"Data" : 
				{
					"EnergyReal_WAC_Plus_Absolute" : 
					{
						"Unit" : "Wh",
						"Values" : 
						{
							"0" : 4468905,
							"10200" : 4469784,
							"10500" : 4469816,

Hopefully my ‘final’ reply :slight_smile: I guess that there are some benefits of being stuck at home.

The script will now automatically select the meter’s serial number and then extract the CONSUMPTION and GENERATION data.

<?php

$dataManagerIP = "fronius";
							
$country = "Australia";
$capitalCity ="Perth";

date_default_timezone_set("$country/$capitalCity");

$date = date('Y-m-d', time());
$pushDate = date('Ymd', time());

// Overide Date for Manual Extract
// $date = "2020-03-01";

$time = date('H:i', time());

// Overide Time for Manual Extract
// $time = "23:59";

$inverterDataURL = "http://".$dataManagerIP."/solar_api/v1/GetMeterRealtimeData.cgi?Scope=System";
$inverterJSON = file_get_contents($inverterDataURL);
$arr = json_decode($inverterJSON, true);

$meterSerial = $arr["Body"]["Data"]["0"]["Details"]["Serial"];

$inverterDataURL = "http://".$dataManagerIP."/solar_api/v1/GetArchiveData.cgi?Scope=System&StartDate=".$date."&EndDate=".$date."&Channel=EnergyReal_WAC_Sum_Produced&Channel=EnergyReal_WAC_Minus_Absolute&Channel=EnergyReal_WAC_Plus_Absolute&Channel=PowerReal_PAC_Sum";
$inverterJSON = file_get_contents($inverterDataURL);
$arr = json_decode($inverterJSON, true);

$x = 0;

$EnergyReal_WAC_Sum_Cumulative = 0;

echo "Time,Energy Generated,Power Generated,Energy Consumed\n";

while ( $x < 86400 && gmdate("H:i", $x) <= $time )
	{
	$EnergyReal_WAC_Sum_Produced = $arr["Body"]["Data"]["inverter/1"]["Data"]["EnergyReal_WAC_Sum_Produced"]["Values"][$x];
	
	$EnergyReal_WAC_Minus_Absolute = $arr["Body"]["Data"]["meter:" . $meterSerial]["Data"]["EnergyReal_WAC_Minus_Absolute"]["Values"][$x];
	$EnergyReal_WAC_Plus_Absolute = $arr["Body"]["Data"]["meter:" . $meterSerial]["Data"]["EnergyReal_WAC_Plus_Absolute"]["Values"][$x];
	$PowerReal_PAC_Sum = $arr["Body"]["Data"]["inverter/1"]["Data"]["PowerReal_PAC_Sum"]["Values"][$x];
	$EnergyReal_WAC_Sum_Cumulative += $EnergyReal_WAC_Sum_Produced;
	
	if ( $x == 0 ) 
		{
		$startMinus = $EnergyReal_WAC_Minus_Absolute;
		$startPlus =  $EnergyReal_WAC_Plus_Absolute;
		}	
	
	$deltaMinus = $EnergyReal_WAC_Minus_Absolute - $startMinus;
	$deltaPlus = $EnergyReal_WAC_Plus_Absolute - $startPlus;
	
	$consumed = $deltaPlus - $deltaMinus + $EnergyReal_WAC_Sum_Cumulative;
	
	$time_value = gmdate("H:i", $x);
	
    // echo gmdate("H:i", $x) . "," . number_format($EnergyReal_WAC_Sum_Cumulative / 1000, 2) . "," . number_format($PowerReal_PAC_Sum, 0) . "," . number_format($consumed / 1000, 2) . "\n";
    echo gmdate("H:i", $x) . "," . $EnergyReal_WAC_Sum_Cumulative . "," . $PowerReal_PAC_Sum . "," . $consumed . "\n";
                
	$x += 300;
	
	}

?>

Grannos, where were you 2 - 3 years ago when my WiFi connection was all flakey and I kept missing chunks of data almost daily? Had to import it long-hand into PVOutput and that was no fun at all :expressionless:

(But, thanks - nice :slight_smile:)

Must have been my pre-Fronius days :slight_smile:

Glad to be of help…

Sorry I’m a complete noob, how do I load the php file to extract this data? I’ve got a couple of days missing I want to fix.

Hi richie83,

(i) You need to be using an operating system which has PHP loaded. If you are using Linux or macOS it’s probably already there. Try typing ‘php -v’ at the command prompt. It should report something like:

marvin (XXXXX) ~ $ php -v

PHP 7.3.11 (cli) (built: Feb 29 2020 02:50:36) ( NTS )

Copyright (c) 1997-2018 The PHP Group

Zend Engine v3.3.11, Copyright (c) 1998-2018 Zend Technologies

If you are using Windows you can get PHP from https://www.php.net/

You will need to save the script, from my earlier post above ( The second version, not the first version ). It needs to be saved as a plain text file - on Windows this can be done with Notepad. The file name should be something memorable like getFroniusData.php

After you edit the DATE & TIME within the PHP file to whatever day you want and set the time to 23:59 ( to get a full day’s worth of data ) and insert the IP address of your inverter, you can then run the script by typing ‘php getFroniusData.php’. If the script runs, if PHP is present, the script will display a day’s worth of data.

N.B. You will NOT get CONSUMPTION data unless you also have a Fronius Smart Meter installed.

The output should look similar to the following - In the sample below starting a midnight there is no PRODUCTION because it is quite dark outside :wink:

marvin (XXXX) ~/Desktop $ php getFroniusArchiveData.php

Time,Energy Generated,Power Generated,Energy Consumed

00:00,0,0,0

00:05,0,0,44

00:10,0,0,86

00:15,0,0,118

00:20,0,0,149

00:25,0,0,179

00:30,0,0,214

00:35,0,0,250

Good Luck

1 Like

Like richie83, I’m a noob at such stuff. But keen to try it, might be a way to automate my own data collection (currently I have each day’s data emailed to me via Solarweb auto reports).

Using a Macbook (Catalina 10.15.3).

I modified the script with relevant city and my Fronius inverter IP address.

$country = "Australia";
$capitalCity = "Sydney";

$inverterDataURL = "http://10.0.0.201/solar_api/v1/GetMeterRealtimeData.cgi?Scope=System";

removed the comment tags for setting the date and time to test getting data for that specific day:

$date = date(‘Y-m-d’, time());
$pushDate = date(‘Ymd’, time());

// Overide Date for Manual Extract
$date = "2020-03-01";

$time = date('H:i', time());

// Overide Time for Manual Extract
$time = "23:59";

Saved as a file on the Desktop.

Worked out how to get the script to run and I get these errors plus the returned data is all zero (I snipped out a lot of the data lines for brevity):

MacBook-Pro-2:~ MacBook$ php /Users/MacBook/Desktop/getFroniusData.php 

Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known in /Users/MacBook/Desktop/getFroniusData.php on line 28

Warning: file_get_contents(http://fronius/solar_api/v1/GetArchiveData.cgi?Scope=System&amp;StartDate=2020-03-01&amp;EndDate=2020-03-01&amp;Channel=EnergyReal_WAC_Sum_Produced&amp;Channel=EnergyReal_WAC_Minus_Absolute&amp;Channel=EnergyReal_WAC_Plus_Absolute&amp;Channel=PowerReal_PAC_Sum): failed to open stream: php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known in /Users/MacBook/Desktop/getFroniusData.php on line 28

Time,Energy Generated,Power Generated,Energy Consumed

00:00,0,,0

00:05,0,,0

00:10,0,,0

00:15,0,,0

00:20,0,,0

00:25,0,,0

00:30,0,,0

00:35,0,,0

00:40,0,,0

00:45,0,,0

00:50,0,,0

00:55,0,,0

01:00,0,,0


08:00,0,,0

08:05,0,,0

08:10,0,,0

08:15,0,,0

08:20,0,,0

08:25,0,,0

08:30,0,,0

08:35,0,,0

08:40,0,,0

08:45,0,,0

08:50,0,,0

08:55,0,,0

09:00,0,,0

09:05,0,,0

09:10,0,,0

09:15,0,,0

09:20,0,,0

09:25,0,,0

09:30,0,,0

09:35,0,,0

09:40,0,,0

09:45,0,,0

09:50,0,,0

09:55,0,,0

10:00,0,,0

10:05,0,,0

10:10,0,,0

10:15,0,,0

10:20,0,,0

10:25,0,,0

10:30,0,,0

10:35,0,,0

10:40,0,,0

10:45,0,,0

10:50,0,,0

10:55,0,,0


23:00,0,,0

23:05,0,,0

23:10,0,,0

23:15,0,,0

23:20,0,,0

23:25,0,,0

23:30,0,,0

23:35,0,,0

23:40,0,,0

23:45,0,,0

23:50,0,,0

23:55,0,,0

MacBook-Pro-2:~ MacBook$

Any clues? Definitely not my area of expertise. TIA but understand if not.

Thanks mate, didn’t even realise you could download a php binary for windows.

Worked absolutely perfect. Not sure if it was supposed to automatically output a csv file as mine didn’t, but I just piped the output running 'php fronius.php >> fronius.csv

Brilliant, thank you so much!

Hey mate, not sure what version of the script you’re running, but the most recent version, all you have to change is the following:

$dataManagerIP = “fronius”;

Change ‘fronius’ to the IP address of your inverter, the most recent version of the script automatically detects the serial number.

Ah, got it. Thanks. Working now!

I’m getting an output now and have been comparing it to the Solarweb report for that day.

Initial 5-min interval at 0:00 gives no energy consumed according to this PHP data extract, but in Solarweb it shows I did consume energy in that 5-min interval.

Otherwise the totals for consumption and production all add up (except consumption for that initial interval).

Be interested to know how to extract either self consumption, or energy import / export to compare with Solarweb data.

Hi All,

Yes glad that everyone’s be able to extract some data. The 0:00 energy reading is zero because the energy used to this point in time is actually the last five minutes of the previous day i.e. 23:55 - 0:00 and I was too lazy to modify the code to extract the early data.

Basically this would require working out the previous date. Allowing for the fact that months have different numbers of days and some years are leap years and what happens if the missing data were from Jan 1st… There’s probably a function someone that does the heavy lifting…

I did some more thinking about this. The ENERGY figures reported by the Data Manager card represent the accumulated values over a 5 minute period. By definition then the first non zero value of the day must occur at 00:05. A non-zero value at 00:00 would be the accumulated energy for the period 23:55 - 0:00 of the previous day and consequently would need to be associated with that day.

Looking at my own PVO data I see that I have no data recorded for 0:00 at all.

G.

PVO has always been missing 5-min of data at the change of day when data comes via Fronius push. It’s a bug IMO.

PVO consumption data has never aligned with Solarweb as a result. It doesn’t affect production data since solar output is nil at midnight anyway.

The data is there, but it gets missed in PVO for some reason each day.

Is that correct though?

In Solarweb data the timestamps mark the beginning of intervals, not the end of intervals.

23:55 -> contains the data for period 23:55 to 23:59:59.99
0:00 -> contains the data for period 0:00 to 0:04:59.99

No they don’t and it would not make sense if they were. The 00:00 generation and consumption energy values are the previous day’s total values (consider the time as 24:00 in effect). The power values at that time should be the average generation and consumption powers over the 23:55 -> 00:00 period. Clearly there is no energy generated in that period and thus the generation power is 0. Since PVOutput was originally only concerned with generation that is why I believe this bug exists because it was never corrected once consumption energy/power was added. I pointed out this PVOutput bug here (and others) years ago.