How to read data direct from Zeversolar Inverter

Hi,

In case you have a Zeversolar inverter with ethernet / WiFi connection, then FYI it’s very simple to pull power & generation data directly from the beast itself.

Simply call http:/<inverter_ip_address>/home.cgi

Try it in your browser even.

Line 11 gives you current watts, line 12 gives you the day’s kWh produced to that point.

note: your version of ComBox software may have the same issue that mine does for kWh numbers. For some reason, Zeversolar think decimal numbers go

     42.8
     42.9
     42.10
     42.11

Simple and robust fix (in case they ever fix this in the firmware) – if the number after the decimal point is a single digit, then put a 0 in front of it :slightly_smiling_face:

If anyone’s interested – I got sick of trying to use the Zevercloud API (and its unreliability) so I’m also pulling more detailed data from the inverters by intercepting traffic between them and the Zevercloud. Can pull individual string voltage & current, inverter temp, AC freq, power etc etc. This, however, requires a) that the inverters can talk to the Zevercloud, and b) a slightly more complex setup on a Linux box (ie Raspberry Pi).

I’m now working on impersonating the Zevercloud and having the inverters upload directly to my Pi. May ironically actually be a simpler setup than the intercept solution.

Anyway, let me know if you’re interested in learning more.

Hope that helps!

1 Like

i’m definitely interested need to setup my old mans zeversolar inverter when its installed and if i can get it to upload the data direct to pvoutput in 5 min intervals it will be alot better than 20 mins.

Just need to somehow measure net data using PVOutput Integration Service or on a CC ENVIR device

I call http:/<inverter_ip_address>/home.cgi 4 times per minute to average out instantaneous power, and then upload that and energy reading every 5 minutes to PVOutput. Works very well. You only need to intercept traffic if you want additional info such as inverter temp, individual string voltage, current, and power, etc.

Do you have the code to grab line 11 and 12?
And or the averaging of instant power.

Is it very difficult to get seperate string power?

Yes.

No.

:rofl:

Sorry, couldn’t resist.

I’m using Node Red on a Raspberry Pi 3, wrote all the code, and set it up to both poll the inverters directly as well as to intercept the traffic between inverters and the Zeversolar cloud, perform the appropriate translations, calculations, & transformations, and then upload the data to both PVOutput as well as Thingspeak.

PVO provides the summary, whilst a bunch of HTML and Javascript I wrote pulls the data from Thingspeak and uses a Highcharts library to present a detailed breakdown.

It isn’t really (yet) a click-and-go type of solution.

What environment are you using?

i have a raspberry pi running my consumption atm using the pvoutput integration service and looking to replace that with a flukso
but will still have the Raspberry Pi1
nothing doing the solar yet as il still trying to get the secret key to do auto uploads for the inverter until i get something going like your setup

i have tried to modify my fronius.php code for the zeversolar

but having issues with opening the http://inverterip/home.cgi
“$inverterJSON = file_get_contents($inverterDataURL);”

its giving me a PHP Warning: file_get_contents(http://inverterip/home.cgi): failed to open stream: HTTP request failed! HTTP/1.1 505 HTTP Version Not Supported
in /home/pi/zeversolar/zever.php on line 33

when i type the url into the web browser it displays but i cant get it to open in php so i can grab the information

how do you grab the two lines?

any chance of sharing the code. i only want to grab the 2 lines and post them every 5 minutes

Looks like you’re using the wrong HTTP version (probably 1.0 instead of 1.1). The stackoverflow bankstownbloke points to should help with that.

$inverterJSON

…implies you are treating the result as JSON which will fail. The data returned is plain text which you will need to parse (ie - just extract lines 11 and 12) - and don’t forget to correct the kWh number…

any chance of sharing the code.

Sorry - I’ve written my solution in a completely different environment and language, so won’t help with your PHP method.

if the code can be run on a Raspberry Pi im happy to change. im just editing the php file for the fronius as i have more chance of modifying it to work than coding something from scratch.
would like to get the other inverter data too but happy enough if i can get this running

unsure if im applying it wrong but i still can’t get it to work

<?php
//    /usr/bin/php /home/pi/zeversolar/zever.php
// Configuration Options
$dataManagerIP = "192.168.x.xx";							//Inverter IP Address
$pvOutputApiKEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxx";
$pvOutputSID = "xxxxxx";
$country = "Australia";
$capitalCity ="Adelaide";			
//Settings that can be Used in V7-V12	
// Inverter					

$v7 = "phase1Volts";
$v8 = "phase2Volts";
$v9 = "phase3Volts";
$v10 = "phase1Amps";
$v11 = "phase2Amps";
$v12 = "phase3Amps";

// !!!!!!!!!!!!!!!! DONT EDIT BELOW HERE !!!!!!!!!!!!!!!!!!!
// Define Date & Time
date_default_timezone_set("$country/$capitalCity");
$system_time= time();
$date = date('Ymd', time());
$time = date('H:i', time());
// Inverter API URL
$pvOutputApiURL = "http://pvoutput.org/service/r2/addstatus.jsp?";
$inverterDataURL = "http://".$dataManagerIP."/home.cgi";

// Read Inverter Data
sleep(5);
//$inverterJSON = file_get_contents($inverterDataURL);
//$inverterData = json_decode($inverterJSON, true);


$context = stream_context_create(array('http'=>array('protocol_version'=>'1.1')));
file_get_contents($inverterDataURL, false, $context);

//Echo "$inverterJSON";





// Push to PVOutput
$pvOutputURL = $pvOutputApiURL
            . "key=" .  $pvOutputApiKEY
            . "&sid=" . $pvOutputSID
            . "&d=" .   $date
            . "&t=" .   $time
            . "&v1=" .  $inverterEnergyDayTotal
            . "&v2=" .  $inverterPowerLive
            . "&v6=" .  $inverterVoltageLive
            . "&v7=" .  $$v7
            . "&v8=" .  $$v8
            . "&v9=" .  $$v9
            . "&v10=" . $$v10
            . "&v11=" . $$v11
            . "&v12=" . $$v12;
file_get_contents(trim($pvOutputURL));													
//Print Values to Console
Echo "\n";
Echo "d \t $date\n";
Echo "t \t $time\n";
Echo "v1 \t $inverterEnergyDayTotal\n";
Echo "v2 \t $inverterPowerLive\n";
Echo "v6 \t $inverterVoltageLive\n";
Echo "v7 \t ${$v7}\n";
Echo "v8 \t ${$v8}\n";
Echo "v9 \t ${$v9}\n";
Echo "v10 \t ${$v10}\n";
Echo "v11 \t ${$v11}\n";
Print "v12 \t ${$v12}\n";
Echo "\n";
Echo "Sending data to PVOutput.org \n";
Echo "$pvOutputURL \n";
Echo "\n";


?>

this is the edited version of the fronius.php still messy and left in the same format.
but 1. I cant open the file as for the http error and 2. dont know how to extract the data once i get it open
anyone able to see what im doing wrong?
Im using php5 if that is causing any issues?

i havent been able to get the secret key or api key etc from zeversolar after nearly a month so this is the next step

Oh. You might have to do a lot more Googling…

file_get_contents returns a string, and it also needs a properly formed address.

Try running the following code to get a feel for it:

<?php
    $context = stream_context_create(array('http'=>array('protocol_version'=>'1.1')));
    $result = file_get_contents('http://192.168.2.123/home.cgi', false, $context);
    echo $result;
?>

Replace 192.168.2.123 with the IP address of your inverter.

You should see a number of lines of data - line 11 giving watts and 12 the day’s kWh up to that point - or get an error (say, if you’ve got the wrong IP address, the inverter’s offline because it’s night time, etc)

You will then have to parse the $result string to extract lines 11 and 12, correct the kWh numbers as per my first post, and then submit that to PVOutput.

that seems to work and gives the lines, now to get the data from those lines
cheers 1 more step left!

while trying codes to extract each line the pi i use stopped responding to commands so i rebooted it
and now im getting

PHP Warning:  file_get_contents(http://192.168.x.xx/home.cgi): failed to open stream: HTTP request failed! 1
 in /home/pi/zeversolar/zever3.php on line 3

using the same code that worked beforehand.
has the inverter blacklisted the ip or something? i can ping the inverter but it is quite slow

Can you get to the home.cgi with your web browser?

How complex is your WiFi setup (could the Pi, for instance, be connecting to another AP)?

Try power cycling the Pi.

This should get you on the right path…

$lines=explode("\n",$result);
$watts=$lines[10];
$kWh=$lines[11];

Cheers i couldnt do any more until i got to the parents.

Im accessing the pi from my vpn . Even after a reboot it still wouldnt work.
I can access fine when im there and connect locally. So something has gone wrong over the vpn.
Will have to test that out when i get there next

Use remote.it instead of a VPN - works perfectly in this scenario.

strange it started working again when i got home

that code was perfect. i was actually trying a similar copy of that code but that’s when things went wrong.

i had to times the eTotal ( kwh by 1000 to get it into watts for pvoutput as it displayed 35.2kwh as .035) but by the time i done that the inverter had shut down so will have to see how it goes tomorrow

i have setup cron and appears to be working great
will have to check how it all goes and tidy the code up then will post it up for others wanting to do the same…

one thing i haven’t done is fix the single digit for kwh, Unsure how to do that or if i need to at this stage.

my combox is

Software Version: 17A31-727R
Hardware Version: M11

Thanks for both of your help saved me about 100 days of stuffing around

Just log the numbers & see if they go up in a sensible fashion. PVOutput doesn’t accept reducing kWh numbers (drops them) so your graph ends up with strange jumps.

Also, I strongly suggest you compare the numbers you see on the inverter’s web pages (ie the human readable form) with what you pull off home.cgi to make sure you’re picking up the right numbers.

something like this might help:

$kWh_parts=explode('.', $kWh);
if (strlen($kWh_parts[1]) == 1) {
	$kWh_parts[1] = '0' . $kWh_parts[1];
	$kWh=join('.',$kWh_parts);
}
echo $kWh;

Im not logging any data locally just grabbing it and uploading straight to pvoutput

https://pvoutput.org/intraday.jsp?id=29186&sid=61410
I have noticed sometimes its not displaying/uploading the data and wondering if that is because the energy total is wrong (needs ur fix) or some other issue
Will add the fix when i can and see if it fixes the rest.

Ignore consumption its net metered but havent worked out how to deal with that yet

im thinking its getting this error when its doesnt upload to pvoutput as it errors out before it can do anything. seems to be hit and miss if it works or not.

PHP Warning: file_get_contents(http://192.168.x.xx/home.cgi): failed to open stream: HTTP request failed! 1

is there an easy way to write a log file of each result whether its everything or just if there’s that error and the results and echos so i can view whats breaking it?

i found some code to retry on error but i have other errors that don’t stop it working but if i ran that it would.

Anyone got any tips?
Still missing logs randomly then when it does pick it up its a huge spike as its logging the total.

Does anyone have a reliable way that i can use?