Page 6 of 12
Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters
Posted: Sunday 03 March 2019 13:02
by Toulon7559
It took some time before I found a contact-address for sending an email to Ginlong.
Perhaps a coincidence, but soon after sending that mail I got access to the Portal2.0

Gives hope that also the related monitoring script will run .....
In the meantime got the experience that the 'mother-file' which I apply for reading the Ginlong Portal2.0, is for Python3 or better.

Not intending to spend time on scripts which are OK, the simplest solution is to install side by side the 'standard' Python2.7 and the 'better' Python3.4. and to control (either outside the script, or within the script as first line) the execution of scripts by direction to the proper folder:
'python' calls Python2.7 and 'python3' calls Python3.X
(Co)installation of Python3.4 is (compared to Python3.7) simple from Putty's CLI by
Code: Select all
sudo apt-get update
sudo pip install python3
The basic installation procedures put the
auxiliary Python-modules in the folders of Python2.7:
This forum-message clearly describes that they are separate, but how to give direction to installation for modules used in either or both dist-packages?
Solution
seems found as useful installation from CLI towards Python3.X:
After that (for example) installation of pymysql towards Python3
should be possible from CLI by
But installed modules don't become visible in the folders for Python3.X:
where did they go?
What am I missing?
And how to proceed?
Hints appreciated!
Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters
Posted: Saturday 30 March 2019 18:49
by sincze
Mmm it seems something is wrong today with Omnikportal:10000 if you try to connect with:
Code: Select all
http://www.omnikportal.com:10000/serverapi/?method=Login&username='.$username.'&password='.$password.'&key=apitest&client=iPhone
ERR_CONNECTION_TIMED_OUT
Let's hope it is fixed tomorrow
Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters
Posted: Monday 01 April 2019 8:40
by rednas
sincze wrote: ↑Saturday 30 March 2019 18:49
Mmm it seems something is wrong today with Omnikportal:10000 if you try to connect with:
Code: Select all
http://www.omnikportal.com:10000/serverapi/?method=Login&username='.$username.'&password='.$password.'&key=apitest&client=iPhone
ERR_CONNECTION_TIMED_OUT
Let's hope it is fixed tomorrow
Same problem here...
Sent them an e-mail and hope they reply soon. Will revert when I have an answer.
Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters
Posted: Monday 01 April 2019 8:48
by jankees
I had the same with the connection to omnikportal:10000
So I wrote a script to grab the data directly from my Omnik inverter to domoticz.
You might try this script as well:
https://github.com/jankeesder/getPVData
Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters
Posted: Monday 01 April 2019 9:22
by sincze
jankees wrote: ↑Monday 01 April 2019 8:48
I had the same with the connection to omnikportal:10000
So I wrote a script to grab the data directly from my Omnik inverter to domoticz.
You might try this script as well:
https://github.com/jankeesder/getPVData
tnx for sharing.
Unfortunately I use the connection to monitor remote inverters of my friends (less tech tech interested people

).
I have no IP connections directly to them, so unfortunately can't use your proposed solution.
Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters
Posted: Monday 01 April 2019 9:52
by jankees
sincze wrote: ↑Monday 01 April 2019 9:22
jankees wrote: ↑Monday 01 April 2019 8:48
I had the same with the connection to omnikportal:10000
So I wrote a script to grab the data directly from my Omnik inverter to domoticz.
You might try this script as well:
https://github.com/jankeesder/getPVData
tnx for sharing.
Unfortunately I use the connection to monitor remote inverters of my friends (less tech tech interested people

).
I have no IP connections directly to them, so unfortunately can't use your proposed solution.
Ah that's another situation...

Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters
Posted: Monday 01 April 2019 9:52
by rednas
jankees wrote: ↑Monday 01 April 2019 8:48
I had the same with the connection to omnikportal:10000
So I wrote a script to grab the data directly from my Omnik inverter to domoticz.
You might try this script as well:
https://github.com/jankeesder/getPVData
The script throws an error.
When I am requesting the status.html it shows no PV data. So, this looks not to be working for me...
Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters
Posted: Monday 01 April 2019 10:22
by jankees
rednas wrote: ↑Monday 01 April 2019 9:52
jankees wrote: ↑Monday 01 April 2019 8:48
I had the same with the connection to omnikportal:10000
So I wrote a script to grab the data directly from my Omnik inverter to domoticz.
You might try this script as well:
https://github.com/jankeesder/getPVData
The script throws an error.
When I am requesting the status.html it shows no PV data. So, this looks not to be working for me...
Probably in your browser the status.html shows only some lines. But in the source of status.html is some javascript code where the webserver declares the variables with the values of the usage and the total today.
The script grabs these values and put them into Domoticz.
Could you post the error?
Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters
Posted: Monday 01 April 2019 12:57
by rednas
This is what is shown:
Code: Select all
Traceback (most recent call last):
File "getPVData.py", line 46, in <module>
etotal1000 = float(totalOveral) * float(multiply)
ValueError: could not convert string to float: stylecolor:#666666font-weight:bold></div><divclasscl></div><divclassline></div><divclasslab_l2stylecolor:#666666font-weight:boldidtx9></div><divclasslab_r2
However when I look at the source and when I output the source in putty I am seeing the same source, without these variables.
Some javascript variables that are shown are:
Code: Select all
addCfg('wifi_on',0x0f070200,'enable');
addCfg('sta_ssid',0x04df0200,'XXX');
addCfg('ap_ssid',0x043c0200,'AP_XXX');
addCfg('lan_ip',0x02080300,'10.10.100.254');
addCfg('sta_enable',0x04d40100,'1');
var st_con1=""; var st_con2=""; var st_con3="";
Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters
Posted: Monday 01 April 2019 14:25
by sincze
rednas wrote: ↑Monday 01 April 2019 8:40
sincze wrote: ↑Saturday 30 March 2019 18:49
Mmm it seems something is wrong today with Omnikportal:10000 if you try to connect with:
Code: Select all
http://www.omnikportal.com:10000/serverapi/?method=Login&username='.$username.'&password='.$password.'&key=apitest&client=iPhone
ERR_CONNECTION_TIMED_OUT
Let's hope it is fixed tomorrow
Same problem here...
Sent them an e-mail and hope they reply soon. Will revert when I have an answer.
As always with these Chinese.... sites... Very well protected... Not.
With a valid cookie you're able to retrieve everybodys info....
Just an example..
Code: Select all
[{"nowpower":"3.20 kW","daypower":"14.81 kWh","monthpower":"14.81 kWh","yearpower":"643.17 kWh","allpower":"21.97 MWh","lasttime":"Apr.01 13:18,GMT +1,2019","commissioned":"Feb.05,2015","capacity":"450 kW","installer":"/","peakpower":"4.87 kW","efficiency":"0.03 kWh/kW/day","treesplanted":"60.02 trees","co2":"21.91 ton","income":"€5.05K"}]

- Omnik.JPG (36.37 KiB) Viewed 2889 times
Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters
Posted: Monday 01 April 2019 16:22
by thijsvb
I'm experiencing issues with communication to the omnikportal:10000 as well!
Somebody received any information from their side yet?
Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters
Posted: Monday 01 April 2019 20:55
by sincze
At least it is possible to retrieve data from the portal without a login.

- Omnik-nologin.JPG (23.16 KiB) Viewed 2873 times
Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters
Posted: Monday 01 April 2019 22:20
by jankees
rednas wrote: ↑Monday 01 April 2019 12:57
This is what is shown:
Code: Select all
Traceback (most recent call last):
File "getPVData.py", line 46, in <module>
etotal1000 = float(totalOveral) * float(multiply)
ValueError: could not convert string to float: stylecolor:#666666font-weight:bold></div><divclasscl></div><divclassline></div><divclasslab_l2stylecolor:#666666font-weight:boldidtx9></div><divclasslab_r2
However when I look at the source and when I output the source in putty I am seeing the same source, without these variables.
Some javascript variables that are shown are:
Code: Select all
addCfg('wifi_on',0x0f070200,'enable');
addCfg('sta_ssid',0x04df0200,'XXX');
addCfg('ap_ssid',0x043c0200,'AP_XXX');
addCfg('lan_ip',0x02080300,'10.10.100.254');
addCfg('sta_enable',0x04d40100,'1');
var st_con1=""; var st_con2=""; var st_con3="";
Ah I see. Than I guess you are using a different inverter model or firmware?
I a have the Omnik3000tl with firmware version (main)V4.08Build215 / (slave)V4.12Build246.
Can you read the current power, total today and overall total from the website of your inverter?
Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters
Posted: Tuesday 02 April 2019 10:47
by sincze
thijsvb wrote: ↑Monday 01 April 2019 16:22
I'm experiencing issues with communication to the omnikportal:10000 as well!
Somebody received any information from their side yet?
It seems they dropped support for the old app. (old app used old api) and did not work anymore as well.

- Omnik-oldapp.JPG (30.05 KiB) Viewed 2851 times
They now have a new app and that one is working.
However that is not the solution to my issue. Needs a bit more work.

Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters
Posted: Tuesday 02 April 2019 16:32
by sincze
At least I can now monitor my friends again.

- Omnikworking.png (30.22 KiB) Viewed 2841 times
Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters
Posted: Tuesday 02 April 2019 16:39
by rednas
sincze wrote: ↑Monday 01 April 2019 20:55
At least it is possible to retrieve data from the portal without a login.
Omnik-nologin.JPG
How did you do this?

Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters
Posted: Tuesday 02 April 2019 18:19
by sincze
rednas wrote:sincze wrote: ↑Monday 01 April 2019 20:55
At least it is possible to retrieve data from the portal without a login.
Omnik-nologin.JPG
How did you do this?

I did it in php (I am a pass2php user). I trick the omnik website to show me the data of my specific public sites and retrieve that data. Parse it and store it in Domoticz.

Sent from my ONEPLUS A6003 using Tapatalk
Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters
Posted: Wednesday 03 April 2019 8:09
by rednas
sincze wrote: ↑Tuesday 02 April 2019 18:19
rednas wrote:sincze wrote: ↑Monday 01 April 2019 20:55
At least it is possible to retrieve data from the portal without a login.
Omnik-nologin.JPG
How did you do this?

I did it in php (I am a pass2php user). I trick the omnik website to show me the data of my specific public sites and retrieve that data. Parse it and store it in Domoticz.

Sent from my ONEPLUS A6003 using Tapatalk
Is it possible to share this to us?

Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters
Posted: Wednesday 03 April 2019 8:12
by sincze
rednas wrote:sincze wrote: ↑Tuesday 02 April 2019 18:19
rednas wrote:
How did you do this?

I did it in php (I am a pass2php user). I trick the omnik website to show me the data of my specific public sites and retrieve that data. Parse it and store it in Domoticz.

Sent from my ONEPLUS A6003 using Tapatalk
Is it possible to share this to us?

Ofcourse that is what this community is about

. Let me clean up the code a bit. As I am not a developer

keep in mind it is in php. And based upon pass2php main scripts.
Sent from my ONEPLUS A6003 using Tapatalk
Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters
Posted: Wednesday 03 April 2019 9:52
by sincze
This PHP is what I use at the moment to retrieve the info from the OMNIK public website.
- Spoiler: show
Code: Select all
#!/usr/bin/php
<?PHP
define('rootdir','/var/www/html/secure2/');
require(rootdir.'pass2php_include/settings.php');
if(isset($_REQUEST['text'])){ retrieve_omnik_data_api($_REQUEST['text']); } // 02-04-2019 OMNIK API CHANGED!, The Command to parse is ; separated
function retrieve_omnik_data_api($command) // 01-4-2019 NEW API IMPLEMENTED
{
define('USERNAME', 'guest'); //The username or email address of the account.
define('PASSWORD', ''); //The password of the account.
define('USER_AGENT', 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.2309.372 Safari/537.36'); //Set a user agent. This basically tells the server that we are using Chrome ;)
define('COOKIE_FILE', 'cookie.txt'); //Where our cookie information will be stored (needed for authentication).
define('LOGIN_FORM_URL', 'https://www.omnikportal.com/Terminal/TerminalDefault.aspx?come=Public'); //URL of the login form.
define('LOGIN_ACTION_URL', 'https://www.omnikportal.com/Terminal/TerminalDefault.aspx?come=Public'); //Login action URL. Sometimes, this is the same URL as the login form.
$continue=true;
$postValues = array(
'username' => USERNAME,
'password' => PASSWORD
);
$curl = curl_init(); //Initiate cURL.
curl_setopt($curl, CURLOPT_URL, LOGIN_ACTION_URL); //Set the URL that we want to send our POST request to. In this case, it's the action URL of the login form.
curl_setopt($curl, CURLOPT_POST, true); //Tell cURL that we want to carry out a POST request.
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($postValues)); //Set our post fields / date (from the array above).
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); //We don't want any HTTPS errors.
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); //We don't want any HTTPS errors.
curl_setopt($curl, CURLOPT_COOKIEJAR, COOKIE_FILE); //Where our cookie details are saved. This is typically required for authentication, as the session ID is usually saved in the cookie file.
curl_setopt($curl, CURLOPT_USERAGENT, USER_AGENT); //Sets the user agent. Some websites will attempt to block bot user agents. //Hence the reason I gave it a Chrome user agent.
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); //Tells cURL to return the output once the request has been executed.
curl_setopt($curl, CURLOPT_REFERER, LOGIN_FORM_URL); //Allows us to set the referer header. In this particular case, we are fooling the server into thinking that we were referred by the login form.
curl_setopt($curl, CURLOPT_SSLVERSION, 4);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, false); //Do we want to follow any redirects?
curl_exec($curl); //Execute the login request.
if(curl_errno($curl)){
switch ($http_code = curl_getinfo($curl, CURLINFO_HTTP_CODE)) {
case 200: $continue=true;# OK
//lg('Omnikinverter: Login: Expected HTTP code: ', $http_code);
break;
default: $continue=false;
lg('Omnikinverter: Login: Unexpected HTTP code: ', $http_code);
}
}
if ($continue) {
$inverters = array(
array( 'device' => "Omnik_1", 'id' => omnik_id_1 ), // My PV id's that I monitor.
array( 'device' => "Omnik_2", 'id' => omnik_id_2 ),
array( 'device' => "Omnik_3", 'id' => omnik_id_3 )
);
foreach ($inverters as $inverter) {
$url='https://www.omnikportal.com/AjaxService.ashx?ac=upTerminalMain&psid='.$inverter['id'].'&random='.rand();
//lg('Omnikinverter: '.$inverter['device'].' '.$url);
curl_setopt($curl, CURLOPT_URL, $url); //We should be logged in by now. Let's attempt to access a password protected page
curl_setopt($curl, CURLOPT_COOKIEJAR, COOKIE_FILE); //Use the same cookie file.
curl_setopt($curl, CURLOPT_USERAGENT, USER_AGENT); //Use the same user agent, just in case it is used by the server for session validation.
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 1); //We don't want any HTTPS / SSL errors.
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2); //We don't want any HTTPS / SSL errors.
curl_setopt($curl, CURLOPT_SSLVERSION, 4);
$result = curl_exec($curl); // Execute the GET request and print out the result.
if(curl_errno($curl)){
switch ($http_code = curl_getinfo($curl, CURLINFO_HTTP_CODE)) {
case 200: $continue=true;# OK
//lg('Omnikinverter: Data: Expected HTTP code: ', $http_code);
break;
default: $continue=false;
lg('Omnikinverter: Data: Unexpected HTTP code: ', $http_code);
}
}
if ($continue) {
$data = json_decode($result, JSON_PRETTY_PRINT);
$nowpower = $data[0]['nowpower'];
$todaypower = $data[0]['daypower'];
$nowpower = filter_var( $nowpower, FILTER_SANITIZE_NUMBER_FLOAT);
$todaypower = filter_var( $todaypower, FILTER_SANITIZE_NUMBER_FLOAT);
$str=( (round($nowpower)*10).';'.($todaypower*10) );
lg('Omnikinverter: '.$inverter['device'].' result: '.(round($nowpower)*10).' and: '.($todaypower*10).' for domoticz: '.$str);
if (isset($nowpower) && isset($todaypower) ) ud($inverter['device'],0,$str,'Omnikinverter: Generation updated');
}
}
}
curl_close($curl); // close cURL resource, and free up system resources
}
?>