Fronius Inverter Solar API V1

others protocols
Lore_
Posts: 11
Joined: Wed May 17, 2017 3:46 pm

Re: Fronius Inverter Solar API V1

Post by Lore_ » Thu May 18, 2017 3:01 pm

Hi jeanmarc,

yes,I had corrected the IP address.
After I come home, I try and tell you what happens
Thanks again.

Lore_
Posts: 11
Joined: Wed May 17, 2017 3:46 pm

Re: Fronius Inverter Solar API V1

Post by Lore_ » Thu May 18, 2017 7:04 pm

Hi jeanmarc,

this is the error:

"PHP Fatal error: Call to undefined function curl_init() in /var/www/123solar/scripts/protocols/fronius.php on line 14"

jeanmarc
Posts: 1586
Joined: Thu Aug 29, 2013 7:16 am

Re: Fronius Inverter Solar API V1

Post by jeanmarc » Fri May 19, 2017 7:10 am

You need to enable Json, Calendar and Curl extensions in php.ini, it's mandatory to run 123s or meterN.
Edit /etc/php/php.ini and uncomment extension=calendar.so extension=curl.so
Then you may need restart the PHP service.

Lore_
Posts: 11
Joined: Wed May 17, 2017 3:46 pm

Re: Fronius Inverter Solar API V1

Post by Lore_ » Fri May 19, 2017 7:58 am

Hi jeanmarc,

I reinstalled php5 "sudo apt-get install php5-curl", and this is the answer of the test comunication:

Communication is ok !

Arrays
I1V : 352.5 I1A : 1.4 I1P : 493.5
I2V : I2A : I2P :
I3V : I3A : I3P :
I4V : I4A : I4P :
Grid
G1V : 232.6 G1A : 2.23 G1P : 462
G2V : G2A : G2P :
G3V : G3A : G3P :
Inverter
FRQ : 49.96 EFF : 93.62 INVT : BOOT : KWHT : 1149.817

but 123solar don't start, the botton on the admin page remains OFF

Metern is ok

Thanks

jeanmarc
Posts: 1586
Joined: Thu Aug 29, 2013 7:16 am

Re: Fronius Inverter Solar API V1

Post by jeanmarc » Fri May 19, 2017 8:05 am

:? enable debug in main configuration, then start 123s and check the errors log in debugger

Lore_
Posts: 11
Joined: Wed May 17, 2017 3:46 pm

Re: Fronius Inverter Solar API V1

Post by Lore_ » Fri May 19, 2017 8:10 am

Hi jeanmarc,

this is the error log:

19/05/2017 09:07:38 Starting 123Solar

PHP Warning: include(protocols/fronius_checks.php): failed to open stream: No such file or directory in /var/www/123solar/scripts/123solar.php on line 529
PHP Warning: include(): Failed opening 'protocols/fronius_checks.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/123solar/scripts/123solar.php on line 529
PHP Fatal error: Cannot redeclare is_json() (previously declared in /var/www/123solar/scripts/protocols/fronius.php:8) in /var/www/123solar/scripts/protocols/fronius.php on line 12

jeanmarc
Posts: 1586
Joined: Thu Aug 29, 2013 7:16 am

Re: Fronius Inverter Solar API V1

Post by jeanmarc » Fri May 19, 2017 8:48 am

ok, so we are progressing ;) try this

scripts/protocols/fronius.php

Code: Select all

<?php
if (!defined('checkaccess')) {
//    die('Direct access not permitted');
}
// For Fronius https://github.com/victronenergy/dbus-fronius
$CMD_RETURN = ''; // Always initialize

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://localhost/solar_api/v1/GetInverterRealtimeData.cgi?Scope=Device&DeviceID=1&DataCollection=CommonInverterData');
//curl_setopt($ch, CURLOPT_URL, 'http://localhost/scripts/test.php');
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$CMD_RETURN = strip_tags(curl_exec($ch));
curl_close($ch);

$dataarray = json_decode($CMD_RETURN, TRUE);

if (json_last_error() == JSON_ERROR_NONE) {
  //  print_r($dataarray);
  
    // Grid values
    $G1V = $dataarray['Body']['Data']['UAC']['Value'];
    settype($G1V, 'float');
    $G1A = $dataarray['Body']['Data']['IAC']['Value'];
    settype($G1A, 'float');
    $G1P = $dataarray['Body']['Data']['PAC']['Value'];
    settype($G1P, 'float');
    $G2V = null;
    $G2A = null;
    $G2P = null;
    $G3V = null;
    $G3A = null;
    $G3P = null;
    $FRQ = $dataarray['Body']['Data']['FAC']['Value'];
    settype($FRQ, 'float');
    
    // Strings
    $I1V = $dataarray['Body']['Data']['UDC']['Value'];
    settype($I1V, 'float');
    $I1A = $dataarray['Body']['Data']['IDC']['Value'];
    settype($I1A, 'float');
    $I1P = round($I1V * $I1A, 2);
    settype($I1P, 'float');
    $I3V = null;
    $I3A = null;
    $I3P = null;
    $I4V = null;
    $I4A = null;
    $I4P = null;
    
    
    // Inverter
    $EFF = round(($G1P / $I1P) * 100, 1);
    $INVT = null;
    $BOOT = null;
    $KWHT = $dataarray['Body']['Data']['TOTAL_ENERGY']['Value'];
    $KWHT /= 1000;
    settype($KWHT, 'float');
 
    $RET = 'OK';
} else {
    $RET = 'NOK';
}
?>
scripts/protocols/fronius_checks.php

Code: Select all

<?php
if(!defined('checkaccess')){die('Direct access not permitted');}

// State
$STATE = 'no invt status';

// Alarms
$ALARM = null;
$MESSAGE = null;

// Riso, iLeak - Peak Powers
$RISO = 0;
$ILEAK = 0;
$PPEAK = 0;
$PPEAKOTD = 0;
?>
fronius_startup.php

Code: Select all

<?php
if(!defined('checkaccess')){die('Direct access not permitted');}
// Info file
// $CMD_INFO = '';

// Sync inverter
// $CMD_SYNC = '';
?>

Lore_
Posts: 11
Joined: Wed May 17, 2017 3:46 pm

Re: Fronius Inverter Solar API V1

Post by Lore_ » Fri May 19, 2017 9:21 am

Hi jeanmarc,

yes, it's running all

Thanks very very much :D :D :D

Now I try to load the historical data, downloading them from the inverter

jeanmarc
Posts: 1586
Joined: Thu Aug 29, 2013 7:16 am

Re: Fronius Inverter Solar API V1

Post by jeanmarc » Fri May 19, 2017 10:43 am

Neat ;) Is the pooling refreshing time fast ? The local network load isn't too busy with the requests ?

Lore_
Posts: 11
Joined: Wed May 17, 2017 3:46 pm

Re: Fronius Inverter Solar API V1

Post by Lore_ » Fri May 19, 2017 11:20 am

Hi jeanmarc,
Is the pooling refreshing time fast ?
yes, I think so.
The local network load isn't too busy with the requests ?
it does not seem to me, but there is a system to understand that

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest