Omnik Export Script

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

pgit
Posts: 12
Joined: Monday 04 August 2014 17:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Omnik Export Script

Post by pgit »

It looks like Woutrrr has further devellopped Omnik-Data-Logger on https://github.com/Woutrrr/Omnik-Data-Logger.
It now uses a new file PluginLoader.py for output to Mysql, PVoutput, CSV and to the console.
Also make note of the additional settings in config.cfg.
Since the procedure to enable or disable these output options and to log does not use xxxx_enabled variables anymore, the modifications to the script in order to output to Domoticz should be adjusted as well.
Sorry, I am not a Python programmer...

http://tweaken.blogspot.nl/2015/01/domo ... utorg.html and http://www.domoticz.com/wiki/Upload_ene ... o_PVoutput both show (pretty complicated) ways to combine data from a (smart)electricity-meter (import and export) and PV energy data (production) to calculate consumption and upload this to PVoutput and Domoticz too.
I dislike to schedule more than one script to make api-calls and upload to PVoutput, with the risk of overlapping etc.
Couldn't someone combine calculating consumption and uploading this to PVoutput and Domoticz in the adapted OmnikExport.py script to make things simpler and less prone to errors?
mvroosmalen
Posts: 23
Joined: Saturday 03 December 2016 16:36
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Omnik Export Script

Post by mvroosmalen »

Thanks to these post I'm almost ready at a point it works.

I still have two issue:
msg.e_today() and msg.temperature() both complain:
'svalue':msg.temperature(),
TypeError: 'float' object is not callable

python LiveStats.py shows:
ID: 000xxxxxxxx
E Today: 2.1 Total: 47.0
H Total: 0 Temp: 31.4
PV1 V: 176.0 I: 0.2
PV2 V: 0.0 I: 0.0
PV3 V: 0.0 I: 0.0
L1 P: 23 V: 230.5 I: 0.1 F: 50.0
L2 P: 0 V: 0.0 I: 0.0 F: 0.0
L3 P: 230 V: 0.0 I: 0.0 F: 0.13

My best guess is that the numbers don't correspond to the give position number in the functions in InverterMsg.py.

Can someone help me out here???

Thanks

Mark
mvroosmalen
Posts: 23
Joined: Saturday 03 December 2016 16:36
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Omnik Export Script

Post by mvroosmalen »

Hi,

New update:

I removed :
@property
above def temperature(self) & def e_today(self)

in InverterMsg.py

Now it seems to work without errors :D ... Stll don't understand it completely.. anyway its dark so not way to test it anymore.. Hope this is helpful for others too.

Mark
jpbtew
Posts: 14
Joined: Monday 04 April 2016 13:52
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.6132
Contact:

Re: Omnik Export Script

Post by jpbtew »

Hello, (sorry for my poor english...)

i hope someone can help me..... i'm trying to get this work for a couple of weeks now but without any succes..
Livestats.py and omnikexport.py is working and I managed to get the pvoutput working as well.. (but unfortunately no automatic update....)

Im trying to visualize the data in domoticz, i've put the text in Omnik-Export.py.
But i'm getting the following error:

pi@raspberrypi ~/domoticz/Omnik-Data-Logger $ python Omnik-Export.py
Traceback (most recent call last):
File "Omnik-Export.py", line 82, in <module>
s.sendall(InverterMsg.generate_string(wifi_serial))
AttributeError: 'module' object has no attribute 'generate_string'

What do I have to change to get the string wright? I've tried the copies that were uploaded in the post above but i can't get it working...

Hope someone can help me with this...
Attachments
Omnik-Export.txt
(8.63 KiB) Downloaded 69 times
InverterMsg.txt
(5.21 KiB) Downloaded 53 times
config.txt
(1.42 KiB) Downloaded 101 times
mvroosmalen
Posts: 23
Joined: Saturday 03 December 2016 16:36
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Omnik Export Script

Post by mvroosmalen »

Hi,

The following is missing in InverterMsg.py

def generate_string(ser):
'''
The request string is build from several parts. The first part is a
fixed 4 char string; the second part is the reversed hex notation of
the s/n twice; then again a fixed string of two chars; a checksum of
the double s/n with an offset; and finally a fixed ending char.
'''
responseString = '\x68\x02\x40\x30';

doublehex = hex(ser)[2:]*2
hexlist = [ doublehex[i:i+2].decode('hex') for i in
reversed(range(0, len(doublehex), 2))]

cs_count = 115 + sum([ ord(c) for c in hexlist])
cs = hex(cs_count)[-2:].decode('hex')
responseString += ''.join(hexlist) + '\x01\x00'+cs+'\x16'
return responseString

Paste at the end of the file and it should work.

s6

Mark
jpbtew
Posts: 14
Joined: Monday 04 April 2016 13:52
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.6132
Contact:

Re: Omnik Export Script

Post by jpbtew »

Thanks for the response,

I have adjusted the text ... but unfortunately it does not work. I get the following error code:

pi@raspberrypi ~/domoticz/Omnik-Data-Logger $ python LiveStats.py
Traceback (most recent call last):
File "LiveStats.py", line 7, in <module>
import OmnikExport
File "/home/pi/domoticz/Omnik-Data-Logger/OmnikExport.py", line 146
"""
^
IndentationError: expected an indented block

Does this has to do with the way I have saved the files?


Sincerely
jpbtew
Posts: 14
Joined: Monday 04 April 2016 13:52
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.6132
Contact:

Re: Omnik Export Script

Post by jpbtew »

wrong copy/paste.....

pi@raspberrypi ~/domoticz/Omnik-Data-Logger $ python LiveStats.py
Traceback (most recent call last):
File "LiveStats.py", line 7, in <module>
import OmnikExport
File "/home/pi/domoticz/Omnik-Data-Logger/OmnikExport.py", line 14, in <module>
import InverterMsg # Import the Msg handler
File "/home/pi/domoticz/Omnik-Data-Logger/InverterMsg.py", line 195
def generate_string(ser):
^
IndentationError: expected an indented block
mvroosmalen
Posts: 23
Joined: Saturday 03 December 2016 16:36
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Omnik Export Script

Post by mvroosmalen »

Hi,

The error is related to indenting, see text file.

Mark
gen_string.txt
(706 Bytes) Downloaded 84 times
jpbtew
Posts: 14
Joined: Monday 04 April 2016 13:52
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.6132
Contact:

Re: Omnik Export Script

Post by jpbtew »

Thanks for your reply,

i'm think i'm not that smart...
I do not know what I can do to resolve this...... :(
jpbtew
Posts: 14
Joined: Monday 04 April 2016 13:52
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.6132
Contact:

Re: Omnik Export Script

Post by jpbtew »

pffffff.. getting grey hair......

pi@raspberrypi ~/domoticz/Omnik-Data-Logger $ python Omnik-Export.py
Traceback (most recent call last):
File "Omnik-Export.py", line 103, in <module>
'svalue': msg.getTemp(),
TypeError: 'float' object is not callable


After each problem there's another problem...


nobody a working folder for a Omnik Data Logger???????
jbr79
Posts: 20
Joined: Saturday 17 October 2015 22:23
Target OS: Linux
Domoticz version: 4.10659
Contact:

Re: Omnik Export Script

Post by jbr79 »

Try these files:

You need a working git clone and subsequently a config file that has no space characters before the # signs (the comments) or else all will fail...

Good luck
jpbtew.zip
(4.16 KiB) Downloaded 105 times
jpbtew
Posts: 14
Joined: Monday 04 April 2016 13:52
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.6132
Contact:

Re: Omnik Export Script

Post by jpbtew »

Thanks for your help!

unfortunately I do not get it working. I have checked all the spaces in the config file and that's ok.
Livestats.py also works well and also the upload to pvoutput.

I've attached my files..
I'm using Omnikexport for the PVoutput upload. (this is working great)
I'm using Omnik-Export for Domoticz.. (Not working...)

There's nothing to do but check everything again.... and again.... and again..
Attachments
Omnik.zip
(7.69 KiB) Downloaded 97 times
jpbtew
Posts: 14
Joined: Monday 04 April 2016 13:52
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.6132
Contact:

Re: Omnik Export Script

Post by jpbtew »

YEAH! started over again and copied al the things that i was sure of.
A day of trial and error but now it works!

Thanks for your help, it helped me a lot!!!!

Greetz
rjobaan
Posts: 21
Joined: Sunday 06 December 2015 21:33
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Contact:

Re: Omnik Export Script

Post by rjobaan »

Hopefully its the correct topic
but when running python OmnikExport.py
I am getting below error message
2017-04-21 16:10:13,110 DEBUG Importing output plugin DomoticzOutput
Traceback (most recent call last):
File "OmnikExport.py", line 170, in <module>
omnik_exporter.run()
File "OmnikExport.py", line 52, in run
__import__(plugin_name)
File "/home/pi/domoticz/Omnik-Data-Logger/outputs/DomoticzOutput.py", line 13, in <module>
domoticz_host = config.get('domoticz','domoticz_host')
File "/usr/lib/python2.7/ConfigParser.py", line 330, in get
raise NoSectionError(section)
ConfigParser.NoSectionError: No section: 'domoticz'


So I pressume error is in DomoticzOutput, because when running LiveStats.py I get data so my config.cfg is fine'
Below the first lines of my code in DOmoticzOutput (scripts comes from https://www.domoticz.com/wiki/Omnik_Solar_Inverter)

Code: Select all

#!/usr/bin/python
 
import PluginLoader
import urllib
import urllib2
import ConfigParser
 
config = ConfigParser.RawConfigParser()
 
#change to correct folder.
config.read(['/home/pi/Omnik-Data-Logger/config-default.cfg', '/home/pi/Omnik-Data-Logger/config.cfg'])
 
domoticz_host = config.get('domoticz','domoticz_host')
domoticz_port = config.get('domoticz','domoticz_port')
domoticz_url  = config.get('domoticz','domoticz_url')
But just in case here the part of config.cfg with the section

Code: Select all

[domoticz]
domoticz_host      = 192.168.1.100
domoticz_port      = 3000
domoticz_url       = json.htm
webrazor
Posts: 61
Joined: Monday 09 November 2015 9:33
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: The Netherlands
Contact:

Re: Omnik Export Script

Post by webrazor »

Hello,

Did you get the script working because i have the same error message?
rjobaan wrote:Hopefully its the correct topic
but when running python OmnikExport.py
I am getting below error message
2017-04-21 16:10:13,110 DEBUG Importing output plugin DomoticzOutput
Traceback (most recent call last):
File "OmnikExport.py", line 170, in <module>
omnik_exporter.run()
File "OmnikExport.py", line 52, in run
__import__(plugin_name)
File "/home/pi/domoticz/Omnik-Data-Logger/outputs/DomoticzOutput.py", line 13, in <module>
domoticz_host = config.get('domoticz','domoticz_host')
File "/usr/lib/python2.7/ConfigParser.py", line 330, in get
raise NoSectionError(section)
ConfigParser.NoSectionError: No section: 'domoticz'


So I pressume error is in DomoticzOutput, because when running LiveStats.py I get data so my config.cfg is fine'
Below the first lines of my code in DOmoticzOutput (scripts comes from https://www.domoticz.com/wiki/Omnik_Solar_Inverter)

Code: Select all

#!/usr/bin/python
 
import PluginLoader
import urllib
import urllib2
import ConfigParser
 
config = ConfigParser.RawConfigParser()
 
#change to correct folder.
config.read(['/home/pi/Omnik-Data-Logger/config-default.cfg', '/home/pi/Omnik-Data-Logger/config.cfg'])
 
domoticz_host = config.get('domoticz','domoticz_host')
domoticz_port = config.get('domoticz','domoticz_port')
domoticz_url  = config.get('domoticz','domoticz_url')
But just in case here the part of config.cfg with the section

Code: Select all

[domoticz]
domoticz_host      = 192.168.1.100
domoticz_port      = 3000
domoticz_url       = json.htm
User avatar
sincze
Posts: 1300
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: Omnik Export Script

Post by sincze »

Maybe I am missing something.
I see: File "/home/pi/domoticz/Omnik-Data-Logger/outputs/DomoticzOutput.py", line 13, in <module>

and

#change to correct folder.
config.read(['/home/pi/Omnik-Data-Logger/config-default.cfg', '/home/pi/Omnik-Data-Logger/config.cfg'])

Could it be it is not finding the config file ??
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
webrazor
Posts: 61
Joined: Monday 09 November 2015 9:33
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: The Netherlands
Contact:

Re: Omnik Export Script

Post by webrazor »

Hello,

Still working on it and i got it to work.
Thanks for the help.
User avatar
sincze
Posts: 1300
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: Omnik Export Script

Post by sincze »

If issues with the original idea, please have a look at https://github.com/sincze/Domoticz-Omni ... Web-Plugin
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
rgroothuis
Posts: 347
Joined: Friday 03 April 2015 17:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Omnik Export Script

Post by rgroothuis »

sincze wrote: Tuesday 30 July 2019 19:02 If issues with the original idea, please have a look at https://github.com/sincze/Domoticz-Omni ... Web-Plugin
I really like this idea about the Omnik plugin for Domoticz. I've not tried it yet, still reading on how and what to do to get my solar panel data into Domoticz. Would this plug-in with my Omnik device beause it has serial number: 626267xxx?
User avatar
sincze
Posts: 1300
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: Omnik Export Script

Post by sincze »

rgroothuis wrote: Tuesday 03 December 2019 22:24
sincze wrote: Tuesday 30 July 2019 19:02 If issues with the original idea, please have a look at https://github.com/sincze/Domoticz-Omni ... Web-Plugin
I really like this idea about the Omnik plugin for Domoticz. I've not tried it yet, still reading on how and what to do to get my solar panel data into Domoticz. Would this plug-in with my Omnik device beause it has serial number: 626267xxx?
Don't know the plugin deals with the local Inverter webserver. :lol:
This one does not care about the serial number ;-) it scrapes the data from the webpage of the inverter.
This thread can help you ;-) https://www.domoticz.com/forum/viewtopi ... 65&t=28847
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest