Omnik protocol
Omnik protocol
I substituted a PVI 3.0 with 3.0 Omnik, on line research for Omnik logger result only WiFi loggin that intercepting the data flow to omnik portal:
https://github.com/Woutrrr/Omnik-Data-Logger
https://github.com/t3kpunk/Omniksol-PV-Logger
etc
but I wanted through RS485 / 422,
I would like to create a python script or php to read data from the serial.
I sniffed the transmissions between a solarlog 1000 and via RS422 Inverter with one USB485 on Rx+/Tx+ and one on RX-/TX-
String data from SL to inverter is :
"3a 3a 01 00 00 01 11 02 00 00 89"
the response string from inverter is
"3a 3a 00 01 01 00 11 82 20 00 e0 0e dc 0e d4 00 0a 00 0d 00 26 09 54 13 89 03 76 00 00 00 20 00 00 00 00 00 01 00 00 00 00 05 a5" is :
3a3a00010100118220 Header
00e0 Temp
0edc VP1
0ed4 VP2
000a IP1
000d IP2
0026 IAC
0954 VAC
1389 FRQ
0376 PAC
00000020 TOTAL ENERGY
00000000 HOURS TOTAL ????
0001 MODE ????
0000 ERROR ????
0000 ERROR ????
05a5 CHKSUM
I acquire a USB-RS422 on aliexpress , wait delivery ; I try to write a script to pass data to 123solar, if someone wants to help?
continue..... and sorry for english
https://github.com/Woutrrr/Omnik-Data-Logger
https://github.com/t3kpunk/Omniksol-PV-Logger
etc
but I wanted through RS485 / 422,
I would like to create a python script or php to read data from the serial.
I sniffed the transmissions between a solarlog 1000 and via RS422 Inverter with one USB485 on Rx+/Tx+ and one on RX-/TX-
String data from SL to inverter is :
"3a 3a 01 00 00 01 11 02 00 00 89"
the response string from inverter is
"3a 3a 00 01 01 00 11 82 20 00 e0 0e dc 0e d4 00 0a 00 0d 00 26 09 54 13 89 03 76 00 00 00 20 00 00 00 00 00 01 00 00 00 00 05 a5" is :
3a3a00010100118220 Header
00e0 Temp
0edc VP1
0ed4 VP2
000a IP1
000d IP2
0026 IAC
0954 VAC
1389 FRQ
0376 PAC
00000020 TOTAL ENERGY
00000000 HOURS TOTAL ????
0001 MODE ????
0000 ERROR ????
0000 ERROR ????
05a5 CHKSUM
I acquire a USB-RS422 on aliexpress , wait delivery ; I try to write a script to pass data to 123solar, if someone wants to help?
continue..... and sorry for english
Re: Omnik protocol
Here at last , after many times , this script in Python, read true this adapter USB-RS422 https://it.aliexpress.com/item/YN4852-U ... a4e086a9dc the Omnik TL2 inverter ,
script p1.py
and the script omnik.php for protocol
I'm sorry because some installers profit from the work of Jean Mark, selling logger, and other forums peddle your work for them
script p1.py
Code: Select all
import binascii
import serial
import struct
import time
a = 0
b = 0
d = 0
ser = serial.Serial()
ser.port="/dev/ttyUSB0"
ser.baudrate=9600
ser.parity=serial.PARITY_NONE
ser.stopbits=serial.STOPBITS_ONE
ser.bytesize=serial.EIGHTBITS
ser.timeout = 1
ser.open()
ser.flushInput() #flush input buffer, discarding all its contents
ser.flushOutput()#flush output buffer, aborting current output
ser.write(serial.to_bytes([0x3A,0x3A,0x01,0x00,0x00,0x00,0x10,0x04,0x00,0x00,0x89]))
time.sleep(.100)
ser.write(serial.to_bytes([0x3A,0x3A,0x01,0x00,0x00,0x00,0x10,0x04,0x00,0x00,0x89]))
time.sleep(.100)
ser.write(serial.to_bytes([0x3A,0x3A,0x01,0x00,0x00,0x00,0x10,0x04,0x00,0x00,0x89]))
time.sleep(.100)
ser.write(serial.to_bytes([0x3A,0x3A,0x01,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x85]))
d = ser.readline(27)
d = binascii.hexlify(d)
time.sleep(.100)
ser.write(serial.to_bytes([0x3a,0x3a,0x01,0x00,0x00,0x00,0x10,0x01,0x11,0x49,0x54,0x42,0x4e,0x33,0x30,0x32,0x30,0x31,0x36,0x37,0x56,0x33,0x30,0x32,0x37,0x10,0x04,0x59]))
d = ser.readline(12)
d = binascii.hexlify(d)
ser.write(serial.to_bytes([0x3a,0x3a,0x01,0x00,0x00,0x10,0x11,0x10,0x00,0x00,0xa6])) # richiesta dati trifase
#ser.write(serial.to_bytes([0x3a,0x3a,0x01,0x00,0x00,0x10,0x11,0x02,0x00,0x00,0x98])) # richiesta dati monofase
d = ser.read(112)
d = binascii.hexlify(d)
a = d[19:22]
TEMP = int(a,16)/10
a = d[23:26]
b = d[27:30]
VCC = (int(a,16)+int(b,16))/20
a = d[35:38]
b = d[39:42]
ICC = (int(a,16)+int(b,16))/10
a = d[47:50]
ICA = int(a,16)/10
a = d[59:62]
VCA = int(a,16)/10
a = d[70:74]
FRQ = int(a,16)/100
a = d[74:78]
PCA = int(a,16)
a = d[94:98]
KWHG = int(a,16)/100
if FRQ > 0:
a = (str(TEMP) + " " + str(VCC) + " " + str(ICC) + " " + str(ICA) + " " + str(VCA) + " " + str(FRQ) + " " + str(PCA) + " " + str(KWHG) + " OK")
print (a)
RET = 'OK'
Code: Select all
<?php
// Omnik.php is a program for reading the parameters out via RS422 of Omnik inverters.
// by Gino Rosi
$SDTE = date("Ymd H:i:s");
$d = array();
$FRQ = 0;
$a = exec("python /srv/http/123solar/scripts/protocols/p1.py");
$d = preg_split('/[[:space:]]+/', $a);
$I1V = $d[1];
$I1A = $d[2];
$I1P = $I1V * $I1A;
$I2V = 0;
$I2A = 0;
$I2P = 0;
$FRQ = $d[5];
$G1V = $d[4];
$G1A = $d[3];
$G1P = $d[6];
$EFF = ($G1P/$I1P)*100;
$INVT = $d[0];
$BOOT = 0;
$KWHT = $d[7];
if ($FRQ > 0) {
$RET = 'OK';
}
?>
Last edited by ginorosi on Tue Mar 28, 2017 10:13 am, edited 1 time in total.
Re: Omnik protocol
Hi Gino,
Thanks for the work. Is there any _startup.php and _check.php scripts ?
Is the pooling fast ?
Could you tell me who are the installers that sell 123solar ?
I have to remind them that it's illegal
Thanks for the work. Is there any _startup.php and _check.php scripts ?
Is the pooling fast ?
Could you tell me who are the installers that sell 123solar ?
I have to remind them that it's illegal

Re: Omnik protocol
There are no portals that sell, but in other forums exist installers that mount your system, they do it for free I have doubts.
The script works on Omnik TL2 with RS485 , That in reality is a RS422 4 wire.
Location and list code of error and mode inverter are unknown , the reading is less than a second on Orange PI One, a problem that the total kwh have a decimal and the average is 1200w of the resolution, the total day have 2 decimal and minimum resolution is 120w , the graph as a hacksaw
check
The script works on Omnik TL2 with RS485 , That in reality is a RS422 4 wire.
Location and list code of error and mode inverter are unknown , the reading is less than a second on Orange PI One, a problem that the total kwh have a decimal and the average is 1200w of the resolution, the total day have 2 decimal and minimum resolution is 120w , the graph as a hacksaw
check
startup<?php
if(!defined('checkaccess')){die('Direct access not permitted');}
$ILEAK = 0;
$RISO = 0;
$PPEAK = 0;
$PPEAKOTD = 0;
$RET = 'NOK'; // No output
// Info file
// unset no info $CMD_INFO = "";
// Alarm
// unset no alarm $CMD_ALARM = "";
?>
<?php
if(!defined('checkaccess')){die('Direct access not permitted');}
$CMD_INFO = "";
?>
Re: Omnik protocol
I rewritten the script all in PHP :
If launch from terminal omnik.php work's good , if launch 123solar from terminal and press button START green ok work's and live data is OK ; but booting normally, not START 123solar/admin button is STOP red and not change button START green only STOP , what is the problem , the libraries all long PhpSerial.php?
Code: Select all
<?php
// Omnik.php is a program for reading the parameters out via RS422 of Omnik inverters.
// by Gino Rosi
$SDTE = date("Ymd H:i:s");
$data = array();
$FRQ = 0;
include_once('PhpSerial.php');
$serial = new PhpSerial;
$serial->deviceSet("/dev/ttyUSB0");
$serial->confBaudRate(9600);
$serial->confParity("none");
$serial->confCharacterLength(8);
$serial->confStopBits(1);
$serial->confFlowControl("none");
$serial->deviceOpen();
$str = "\x3a\x3a\x01\x00\x00\x00\x10\x04\x00\x00\x89";
$serial->sendMessage($str);
usleep(100000);
$serial->sendMessage($str);
usleep(100000);
$serial->sendMessage($str);
usleep(100000);
$str = "\x3a\x3a\x01\x00\x00\x00\x10\x00\x00\x00\x85";
$serial->sendMessage($str);
$read = $serial->readPort();
$str = "\x3a\x3a\x01\x00\x00\x00\x10\x01\x11\x49\x54\x42\x4e\x33\x30\x32\x30\x31\x36\x37\x56\x33\x30\x32\x37\x10\x04\x59";
$serial->sendMessage($str);
$read = $serial->readPort();
$str = "\x3a\x3a\x01\x00\x00\x10\x11\x10\x00\x00\xa6";
$serial->sendMessage($str);
$read = $serial->readPort();
$data = bin2hex($read);
$INVT= hexdec(substr($data, 18, 4))/10;
$I1V= (hexdec(substr($data, 22, 4))+hexdec(substr($data, 26, 4)))/20;
if ($I1V < 100) {
$I1V = 360;
}
$I1A= (hexdec(substr($data, 34, 4))+hexdec(substr($data, 38, 4)))/10;
$I1P = $I1V * $I1A;
$G1A= hexdec(substr($data, 46, 4))/10;
$G1V= hexdec(substr($data, 58, 4))/10;
$FRQ= hexdec(substr($data, 70, 4))/100;
$G1P= hexdec(substr($data, 74, 4));
$KWHT= hexdec(substr($data, 93, 5))/100;
$BOOT = 0;
if ($FRQ > 0) {
$RET = 'OK';
print $FRQ;
}
?>
Re: Omnik protocol

Re: Omnik protocol
Resolved!
the error this
Now is very fast , ans less resource is minimal respect to python.
Thank's

search and modify the PhpSerial.php https://stackoverflow.com/questions/233 ... it-working11/11/2017 12:20:11 Stopping 123Solar
11/11/2017 12:20:14 Starting 123Solar
PHP Fatal error: No stty availible, unable to run. in /srv/http/123solar/scripts/protocols/PhpSerial.php on line 55
11/11/2017 12:28:26 Starting 123Solar
Now is very fast , ans less resource is minimal respect to python.
Thank's
-
- Posts: 5
- Joined: Tue Dec 01, 2020 5:12 am
Re: Omnik protocol
I know it's an old thread but i have a problem with omnik inverter 4k tl2. I have 123solar installed on raspberry PI3 with Raspbian Buster. I folloed this guide: http://www.flanesi.it/doku/doku.php?id= ... one_buster
The problem is that i don't see any data from the inverter.
This is the 123solar debug:
and this is line 506 in /var/www/123solar/scripts/123solar.php:
if ($RET != 'OK' && trim($CMD_RETURN) && ($nowUTCs > ($sun_info['sunrise'] + 1800) && $nowUTCs < ($sun_info['sunset'] - 1800))) { //NOK
I olso did a communication test with these parameters:
Any idea?
Complimenti Gino per il lavoro!
The problem is that i don't see any data from the inverter.
This is the 123solar debug:
Code: Select all
#* 09/12/2020 15:00:34 Starting 123Solar debug (9419)
PHP Notice: Undefined variable: CMD_RETURN in /var/www/123solar/scripts/123solar.php on line 506
PHP Notice: Undefined variable: CMD_RETURN in /var/www/123solar/scripts/123solar.php on line 506
PHP Notice: Undefined variable: CMD_RETURN in /var/www/123solar/scripts/123solar.php on line 506
PHP Notice: Undefined variable: CMD_RETURN in /var/www/123solar/scripts/123solar.php on line 506
PHP Notice: Undefined variable: CMD_RETURN in /var/www/123solar/scripts/123solar.php on line 506
if ($RET != 'OK' && trim($CMD_RETURN) && ($nowUTCs > ($sun_info['sunrise'] + 1800) && $nowUTCs < ($sun_info['sunset'] - 1800))) { //NOK
I olso did a communication test with these parameters:
Code: Select all
inverter: omnik protocol
single: phase
Port: /dev/ttyUSB0
RS485 | IP adress : 0
Communication options : -Y3
1 : ERROR !
2 : ERROR !
3 : ERROR !
4 : ERROR !
5 : ERROR !
6 : ERROR !
7 : ERROR !
8 : ERROR !
9 : ERROR !
10 : ERROR !
Errors while testing :
Complimenti Gino per il lavoro!
Re: Omnik protocol
For the error in line 506, the scripts/protocols/omnik.php need to have a $CMD_RETURN = ''; on top.
Read _protocols.txt in that directory : $CMD_RETURN The return string. Always initialize to allow the 'Communication Error' test
Try always you com app alone : README (who does anyway)
Install and test the communication application(s) for your inverter(s) and make sure it is reliable !
Read _protocols.txt in that directory : $CMD_RETURN The return string. Always initialize to allow the 'Communication Error' test
Try always you com app alone : README (who does anyway)
Install and test the communication application(s) for your inverter(s) and make sure it is reliable !
Who is online
Users browsing this forum: No registered users and 3 guests