KACO Powador web server

others protocols
andy
Posts: 46
Joined: Wed May 04, 2016 10:25 am
Location: Ukraine
Contact:

Re: KACO Powador

Post by andy » Sat Jun 17, 2017 10:16 pm

Hi jaenmarc
big thanks for script.
As I understand, the main problem is that there is no live KWHT
File realtime.csv not contain any cumulative data and can only be used to read the status of the inverter

maybe use this link
IP:port/eternal.csv

Code: Select all

 *******;1;192.168.5.105;427.17ield[kWh]
as i understand - this is cumulative ield from all time (sorry for my very bad english)))
1 how i can add this inveter to 123s? (kaco-tcp)
2 how i can import old data (in my case from 31-05-2017 to 7-06-2017) from inverter?
cumulative kwh may use 0 - at the beginning of the day and value from yyyymm.csv at the end of the day

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

Re: KACO Powador

Post by jeanmarc » Sun Jun 18, 2017 7:43 am

Hi,
The problem is the precison of your counter. It could also work if you have a precise daily counter.

1) Could you reopen the access so i could take a look ? (eternal.csv)
2) To import production values without details, create energy files in data/invt1/production/energy2016.csv

Code: Select all

20170101,2.533
20170102,0.569
20170103,3.552
20170104,1.332
and so on..
The values are in kWh. You can use your YYYY.csv and modify the format with Calc spreadsheet, beware to keep the csv format. Then, check with a plain text editor like notepad++ and remove title, blank lines,...
You must also keep the energy2016 writable for later use.

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

Re: KACO Powador

Post by jeanmarc » Sun Jun 18, 2017 10:04 am

With this counter precision, you will have bad rendering graph, especially when there is not much production :?

Code: Select all

<?php
if (!defined('checkaccess')) {
    //    die('Direct access not permitted');
}
// For KACO Powador (work in progress)
$CMD_RETURN = ''; // Always initialize

/*
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://localhost/realtime.csv');
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$CMD_RETURN = strip_tags(curl_exec($ch));
curl_close($ch);

$line = preg_split('/;/', $CMD_RETURN);
*/

    if ($handle = fopen("http://localhost/realtime.csv", 'r')) {
        $line = fgetcsv($handle, 1000, ';');
        print_r($line);
    }

if (isset($line[13])) {
    // Grid values
    $G1V = (float) ($line[3] / (1600 * 65535));
    $G1V = round($G1V, 2);
    $G1A = (float) ($line[8] / (200 * 65535));
    $G1A = round($G1A, 2);
    $G1P = (float) ($line[11] / (100000 * 65535));
    $G1P = round($G1P, 2);

    $G2V = (float) ($line[4] / (1600 * 65535));
    $G2V = round($G2V, 2);
    $G2A = (float) ($line[9] / (200 * 65535));
    $G2A = round($G2A, 2);
    $G2P = null;

    $G3V = (float) ($line[5] / (1600 * 65535));
    $G3V = round($G3V, 2);
    $G3A = (float) ($line[10] / (200 * 65535));
    $G3A = round($G3A, 2);
    $G3P = null;

    $FRQ = null;
    
    // Strings
    $I1V = (float) ($line[1] / (1600 * 65535));
    $I1V = round($I1V, 2);
    $I1A = (float) ($line[6] / (200 * 65535));
    $I1A = round($I1A, 2);
    $I1P = null;
    
    $I2V = (float) ($line[2] / (1600 * 65535));
    $I2V = round($I2V, 2);
    $I2A = (float) ($line[7] / (200 * 65535));
    $I2A = round($I2A, 2);
    $I2P = (float) ($line[6] / (200 * 65535));
    $I2P = round($I2P, 2);
    
    $I3V = null;
    $I3A = null;
    $I3P = null;
    $I4V = null;
    $I4A = null;
    $I4P = null;
    
    // Inverter
    //$EFF = round(($G1P / $I1P) * 100, 1);
    $EFF  = null;
    $INVT = $G3A = (float) ($line[12] / 100);
    $BOOT = null;
    
    // Getting KWHT in Wh, the value should always increase !
    // Here's the hassle, your counter isn't precise enough
    
    if ($handle = fopen("http://localhost/eternal.csv", 'r')) {
        $line = fgetcsv($handle, 1000, ';');
        //print_r($line);
    }
    
    $KWHT = preg_replace('/[^0-9.]+/', '', $line[8]);
    if (isset($KWHT)) {

        echo "
G1V: $G1V V
G1A: $G1A A
G1P: $G1P W
G2V: $G2V 
G2A: $G2A 
G2P: $G2P 
G3V: $G3V 
G3A: $G3V 
G3P: $G3P 

FRQ: $FRQ 
I1V: $I1V 
I1A: $I1A 
I1P: $I1P 
I2V: $I2V 
I2A: $I2A 
I2P: $I2P 

EFF: $EFF 
INVT: $INVT 

KWT: $KWHT Wh
";
        
        $RET = 'OK';
    } else {
        $RET = 'NOK';
    }
  
} else {
    $RET = 'NOK';
}

?>

andy
Posts: 46
Joined: Wed May 04, 2016 10:25 am
Location: Ukraine
Contact:

Re: KACO Powador

Post by andy » Sun Jun 18, 2017 10:58 am

Jeanmarc big thanks again. About precission of my counter wh. If i use wh counter ONLY from file eternal.csv? As realtime cumulative counter and as counter for month, for year. Btw. access to my inverter still open for you. As i think production wh in graph may use only today. I read this from file realtime.csv and from eternal.csv Then i use only total count of production by day, month,year,etc. I may read this from file yyyymm.csv (wh precission BUT only for tomorrow, not for today) or from file eternal.csv anytime, but with kwh precission. Difrence +-5wh/day. Right?

And how i may use your script in my 123s? Today i use 123s for reading 2 inverters (power-one) . And i have data from inverters (about 6 months). How i may add new inverter with this script?
Last edited by andy on Sun Jun 18, 2017 11:15 am, edited 1 time in total.

andy
Posts: 46
Joined: Wed May 04, 2016 10:25 am
Location: Ukraine
Contact:

Re: KACO Powador

Post by andy » Sun Jun 18, 2017 11:03 am

Another big question. I connect my inverter (kaco) with rs485 interface. I have programm ( python script) to read data from inverter. May i create new topic for discussion about this?
Or continue in this topic?

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

Re: KACO Powador

Post by jeanmarc » Sun Jun 18, 2017 11:51 am

Yup the error would only be max 5Wh a day but the graph use the difference between 5min. And 5Wh is revelant to show the average power.

123solar use the daily detailled file to get later production info. It cannot read elsewhere (yyyymm.csv) the value without tweaking the code. And i surely won't change the main code for 1 Kaco user :geek:

To use the files, create this as scripts/protocols/kaco.php

Code: Select all

<?php
if (!defined('checkaccess')) {
    //    die('Direct access not permitted');
}
// For KACO Powador (work in progress)
$CMD_RETURN = ''; // Always initialize


$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://localhost/realtime.csv');
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$CMD_RETURN = strip_tags(curl_exec($ch));
curl_close($ch);

$line = preg_split('/;/', $CMD_RETURN);
//print_r($line);

if (isset($line[13])) {
    // Grid values
    $G1V = (float) ($line[3] / (65535/1600));
    $G1V = round($G1V, 2);
    $G1A = (float) ($line[8] / (65535/200));
    $G1A = round($G1A, 2);
    $G1P = (float) ($line[11] / (65535/100000));
    $G1P = round($G1P, 2);
    
    $G2V = (float) ($line[4] / (65535/1600));
    $G2V = round($G2V, 2);
    $G2A = (float) ($line[9] / (65535/200));
    $G2A = round($G2A, 2);
    $G2P = null;
    
    $G3V = (float) ($line[5] / (65535/1600));
    $G3V = round($G3V, 2);
    $G3A = (float) ($line[10] / (65535/200));
    $G3A = round($G3A, 2);
    $G3P = null;
    
    $FRQ = null;
    
    // Strings
    $I1V = (float) ($line[1] / (65535/1600));
    $I1V = round($I1V, 2);
    $I1A = (float) ($line[6] / (65535/200));
    $I1A = round($I1A, 2);
    $I1P = null;
    
    $I2V = (float) ($line[2] / (65535/1600));
    $I2V = round($I2V, 2);
    $I2A = (float) ($line[7] / (65535/200));
    $I2A = round($I2A, 2);
    $I2P = (float) ($line[6] / (65535/200));
    $I2P = round($I2P, 2);
    
    $I3V = null;
    $I3A = null;
    $I3P = null;
    $I4V = null;
    $I4A = null;
    $I4P = null;
    
    // Inverter
    //$EFF = round(($G1P / $I1P) * 100, 1);
    $EFF  = null;
    $INVT = $G3A = (float) ($line[12] / 100);
    $BOOT = null;
    
    // Getting KWHT in Wh, the value should always increase !
    // Here's the hassle, your counter isn't precise enough
    
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, 'http://localhost/eternal.csv');
    curl_setopt($ch, CURLOPT_TIMEOUT, 15);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $CMD_RETURN = strip_tags(curl_exec($ch));
    curl_close($ch);
    
    $line = preg_split('/;/', $CMD_RETURN);
    //print_r($line);
    
    $KWHT = preg_replace('/[^0-9.]+/', '', $line[8]);
    if (isset($KWHT)) {
/*
        echo "
        G1V: $G1V V
        G1A: $G1A A
        G1P: $G1P W
        G2V: $G2V 
        G2A: $G2A 
        G2P: $G2P 
        G3V: $G3V 
        G3A: $G3A 
        G3P: $G3P 
        
        FRQ: $FRQ 
        I1V: $I1V 
        I1A: $I1A 
        I1P: $I1P 
        I2V: $I2V 
        I2A: $I2A 
        I2P: $I2P 
        
        EFF: $EFF 
        INVT: $INVT 
        
        KWT: $KWHT Wh
        ";
*/
        $RET = 'OK';
    } else {
        $RET = 'NOK';
    }
    
} else {
    $RET = 'NOK';
}

?>
Also make kaco_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;
?>
and kaco_startup.php

Code: Select all

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

// Sync inverter
// $CMD_SYNC = '';
?>
You can create another topic for the rs485 script. I hope you can get Wh value ;)

andy
Posts: 46
Joined: Wed May 04, 2016 10:25 am
Location: Ukraine
Contact:

Re: KACO Powador

Post by andy » Sun Jun 18, 2017 6:30 pm

Bug thanks again.
I add code to my 123s and try to monitor inverter few days.
This topic temporary closed.
I create new topic to create script with monitor inverter by rs485
And i try to compare 2 kinds of monitoring 1inverter.

andy
Posts: 46
Joined: Wed May 04, 2016 10:25 am
Location: Ukraine
Contact:

Re: KACO Powador web server

Post by andy » Mon Jun 19, 2017 8:42 pm

hi jeanmarc
Is it possible to add to the main functionality the ability to run the script on a schedule?
i want run script every morning to edit file production2017.csv
I can do this through cron, but I would like to have all the functionality in 123

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

Re: KACO Powador web server

Post by jeanmarc » Tue Jun 20, 2017 8:48 am

Yeah.. maybe you can retrieve your value via _startup, it is call once a day.
But energyYYYY.csv files would still be modified by 123s though.

andy
Posts: 46
Joined: Wed May 04, 2016 10:25 am
Location: Ukraine
Contact:

Re: KACO Powador web server

Post by andy » Tue Jun 20, 2017 1:46 pm

But energyYYYY.csv files would still be modified by 123s though.
yes, right, but if i edit file yyymmdd.csv in csv directory? ))

And another question
may i use 2 different 123servers in one computer IF both use rs485 connection (to different inverters)?

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests