Page 2 of 2

Re: Omnik Export Script

Posted: Wednesday 16 November 2016 20:16
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?

Re: Omnik Export Script

Posted: Sunday 22 January 2017 16:45
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

Re: Omnik Export Script

Posted: Sunday 22 January 2017 17:04
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

Re: Omnik Export Script

Posted: Monday 23 January 2017 19:52
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...

Re: Omnik Export Script

Posted: Tuesday 24 January 2017 22:42
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

Re: Omnik Export Script

Posted: Saturday 28 January 2017 13:37
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

Re: Omnik Export Script

Posted: Saturday 28 January 2017 13:58
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

Re: Omnik Export Script

Posted: Sunday 29 January 2017 19:01
by mvroosmalen
Hi,

The error is related to indenting, see text file.

Mark
gen_string.txt
(706 Bytes) Downloaded 101 times

Re: Omnik Export Script

Posted: Monday 30 January 2017 17:15
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...... :(

Re: Omnik Export Script

Posted: Saturday 04 February 2017 14:21
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???????

Re: Omnik Export Script

Posted: Saturday 04 February 2017 15:08
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 115 times

Re: Omnik Export Script

Posted: Sunday 05 February 2017 11:08
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..

Re: Omnik Export Script

Posted: Sunday 05 February 2017 15:30
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

Re: Omnik Export Script

Posted: Friday 21 April 2017 16:29
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

Re: Omnik Export Script

Posted: Tuesday 27 June 2017 15:34
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

Re: Omnik Export Script

Posted: Tuesday 27 June 2017 20:56
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 ??

Re: Omnik Export Script

Posted: Wednesday 28 June 2017 16:40
by webrazor
Hello,

Still working on it and i got it to work.
Thanks for the help.

Re: Omnik Export Script

Posted: Tuesday 30 July 2019 19:02
by sincze
If issues with the original idea, please have a look at https://github.com/sincze/Domoticz-Omni ... Web-Plugin

Re: Omnik Export Script

Posted: Tuesday 03 December 2019 22:24
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?

Re: Omnik Export Script

Posted: Wednesday 04 December 2019 10:20
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