Ginlong, Omnik Solar, Solarman and Trannergy Inverters

Python and python framework
User avatar
Derik
Posts: 2115
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters

Post by Derik » Saturday 17 March 2018 13:02

Dear Alla..
Did run this script for a few years...
I need to do a clean install.
And now i cannot get the script to work..
When i read the topic i need a specail version of python..:

Code: Select all

odroid@odroid:~$  sudo apt-get install idle-python3.4
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 idle-python3.4 : Depends: python3.4 but it is not going to be installed
                  Depends: python3.4-tk
E: Unable to correct problems, you have held broken packages.
Only i still get an error..
hope some will help me

Thanks
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups

RichardBokker
Posts: 47
Joined: Thursday 09 April 2015 20:57
Target OS: Raspberry Pi
Domoticz version: 3.9317
Location: Netherlands
Contact:

Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters

Post by RichardBokker » Wednesday 25 April 2018 12:20

Still working like a charm! thnx.

anyone idea how fast i can run crontab to read out Ginlong? Because 5 minutes interval is to slow, thinking about 10 seconds or so.. :D
Don't know if ginlong will run at that frequency..?

TimZon
Posts: 2
Joined: Saturday 30 June 2018 12:14
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters

Post by TimZon » Saturday 30 June 2018 14:09

Where do i have to start?

Installed Domoticz on raspberry.

Version 4.97 and python is 3.5.3

First make the virtual device and what sensor type do i need to choose?

And which version of the scripts can i use?

Thanks for helping Tim

User avatar
sincze
Posts: 940
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi
Domoticz version: 4.9700
Location: Netherlands
Contact:

Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters

Post by sincze » Sunday 01 July 2018 11:44

TimZon wrote:
Saturday 30 June 2018 14:09
Where do i have to start?

Installed Domoticz on raspberry.

Version 4.97 and python is 3.5.3

First make the virtual device and what sensor type do i need to choose?

And which version of the scripts can i use?

Thanks for helping Tim
Using the wiki would be a nice start to get some ideas on how to create the virtual sensors.
https://www.domoticz.com/wiki/Omnik_Solar_Inverter
The rest comes down to writing down the idx values and using the script in cron.
Version of script depends on the inverter type you have. Probably the last script in the forum is usually the best one. I always start reading at the end and move my wake back to front of the thread.
Using Pass2php since 2016-12
LAN: RFLink, P1-Port, OTGW, MySensors
USB: RFXCom, ZWave
WIFI: Mi-light Wifi-Bridge, Sonoff, ESP8266, Xiaomi Gateway
Solar: Omnik Inverter, PVOutput
Video: Kodi clients with Harmony HUB
Sensors: You name it I probably got 1.

TimZon
Posts: 2
Joined: Saturday 30 June 2018 12:14
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters

Post by TimZon » Monday 02 July 2018 12:53

sincze wrote:
Sunday 01 July 2018 11:44
TimZon wrote:
Saturday 30 June 2018 14:09
Where do i have to start?

Installed Domoticz on raspberry.

Version 4.97 and python is 3.5.3

First make the virtual device and what sensor type do i need to choose?

And which version of the scripts can i use?

Thanks for helping Tim
Using the wiki would be a nice start to get some ideas on how to create the virtual sensors.
https://www.domoticz.com/wiki/Omnik_Solar_Inverter
The rest comes down to writing down the idx values and using the script in cron.
Version of script depends on the inverter type you have. Probably the last script in the forum is usually the best one. I always start reading at the end and move my wake back to front of the thread.
Thanks a lot!

Toulon7559
Posts: 451
Joined: Sunday 23 February 2014 18:56
Target OS: Raspberry Pi
Domoticz version: latest
Location: Hengelo(Ov)/NL
Contact:

Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters

Post by Toulon7559 » Thursday 02 August 2018 18:31

Step1
Got the Ginlong-script running with a SOLIS DLS_L aka DLS_E hooked to a SOLIS700.

Step2
My other inverters by means of their loggers upload info to PVOutput.
;-) Obviously (for complete picture at one place) than a desire to include/upload the SOLIS-information in this collection at PVOutput.
Info on Power and Energy is available from the script 'helping' Domoticz,
Have produced & tested an annex to the Ginlong-script doing that extra job.

Step3
For compatibility of graphs at PVOutput now looking for a source of SOLIS' info on Input_Voltage and Inverter_Temperature.
In the Ginlong monitoring pictures this info is present.
However, calling the infoURL does not show this information.
Therefore the question is: which other URL should be called to get access to that info?
Somebody having that information?

Are any other 'interesting' URLs available to get info from the SOLIS inverters (documented + undocumented)?
Either on the LAN, or at the Ginlong-website?
Example for my FP4All-Loggers: http-URLs, json-URLs and xml-URLs.
Set1 = RPI-B+RFXCom433+S0PCM+Linksprite-shield for BMP180/DS18B20/RS485+DDS238ZN1
Set2 = RPI-3+RFLinkGTW+ESP8266s+PWS_WS7000
Common = 2*PVLogger+PWS_TFA_Nexus+KAKUs
=> Energy & Data Management based on Time and on PV&Consumption&Meteo

Toulon7559
Posts: 451
Joined: Sunday 23 February 2014 18:56
Target OS: Raspberry Pi
Domoticz version: latest
Location: Hengelo(Ov)/NL
Contact:

Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters

Post by Toulon7559 » Sunday 05 August 2018 9:33

As announced under Step2 of my previous message, have extended the script which reads & feeds for Domoticz with a 2nd section feeding to PVOutput.

The code of the full package is below.
Changes relative to the original script:
- text-bar at the start of the 1st, original identifying the script and it's status
- line numbers added in the 1st section to help in trouble-shooting
- 'closing' bar for the 1st section after line 75
- 2nd section prepares and performs the upload to PVOutput
- I could have used the same parameter-names all over the script, but ;-) I'm lazy, and therefore a transition section performs translation between the variables from the 1st section towards the application in the 2nd section
- The 1st section performing upload to Domoticz applies etotal: it works => OK
However, the resolution of etotal is 1 kWh and the resolution of etoday is 0.1 kWh: therefore etoday seems the better choice for the upload to PVOutput.
In the transition section therefore a formula to multiply etoday by 1000, because PVOutput requires all energy-uploads to be in Wh.
- pay attention to proper setting of the cum-flag (due to above argument now set for upload of etoday)!
- Printlines in the 2nd section aid for checking the upload.
- On purpose no linenumbers added to the 2nd section, because to be foreseen that some people will modify & squeeze the script by taking out the redundancies and by application of the same variable-names all over the script.

Code: Select all

#!/usr/bin/python
# --------------------------------------------------
# script compiled by Toulon7559 from various material from forums, 
# version 0.3 for download from Ginlong and upload to Domoticz and to PVOutput on same processor
# --------------------------------------------------
# Line 6
import urllib, urllib2, hashlib
from xml.etree import ElementTree as ET

#config                         <xx> = value or text to fill-in
username 			= '<un>' #your portal username
password 			= '<pw>' #your portal password
baseURL 			= 'http://www.ginlongmonitoring.com:10000' #base url
stationid 			= '<si>' #station id, get this via the station python script
# Line 15
# example: Working base urls:
#      http://www.ginlongmonitoring.com:10000/
#      http://www.omnikportal.com:10000/
#      http://log.trannergy.com:10000/
#      http://www.solarmanpv.com:10000/
# Line 21
#domoticz settings
domoticz_host      	= '127.0.0.1' # 127.0.0.1 is for local host
domoticz_port      	= '8080'
domoticz_url       	= 'json.htm'
domoticz_ActualPower   = '<idx>' #idx of new device

# Line 28
m = hashlib.md5()
m.update(password)

# Line 32
#building url
requestURL = baseURL+'/serverapi/?method=Login&username='+username+'&password='+m.hexdigest()+'&key=apitest&client=iPhone'

#login call
root = ET.parse(urllib.urlopen(requestURL)).getroot()
token = root.find('token').text

print 'Logged In: '+username

# Line 41
#info url
infoURL = baseURL+'/serverapi/?method=Data&username='+username+'&stationid='+stationid+'&token='+token+'&key=apitest'

print 'Getting Info... '

# Line 47
#login call
infoRoot = ET.parse(urllib.urlopen(infoURL)).getroot()

income = infoRoot.find('income')
TodayIncome = income.find('TodayIncome').text
ActualPower = income.find('ActualPower').text
etoday = income.find('etoday').text  
etotal = income.find('etotal').text

multiply='1000.0'
etotal1000 = float(etotal) * float(multiply)
TotalIncome = income.find('TotalIncome').text
etotalstr=str(etotal1000)

# Line 62
#logging values
print 'TodayIncome: '+TodayIncome
print 'ActualPower: '+ActualPower
print 'etoday: '+etoday
print 'etotal: '+etotal
print 'etotal 1000: '+etotalstr

# Line 70
#uploading values to domoticz
url = ("http://" + domoticz_host + ":" + domoticz_port + "/" + domoticz_url+ "?type=command&param=udevice&idx=" + domoticz_ActualPower+ "&nvalue=0&svalue=" + ActualPower+ ";" + etotalstr)
urllib.urlopen(url)

# Line 75
# --------------------------------------------------
# END OF UPLOAD TO DOMOTICZ
# --------------------------------------------------

# Setting & Translation for values in next section
TEMPINV = 0
VOLTAGE = 0
POWER = ActualPower
LIFEENERGY = etotal1000   # Energy in Wh
multiply='1000.0'
etoday1000 = float(etoday) * float(multiply)
DAYENERGY = etoday1000  # Energy in Wh

# --------------------------------------------------
# START OF UPLOAD TO PVOUTPUT
# --------------------------------------------------
# Settings for PVOutput
pvout_enabled   = True
pvout_apikey    = "<your full API-key for PVOutput>"
pvout_sysid     = <SID at PVOutput>
pvout_cumflag   = 0   # flag is 1 if you apply lifetime-energy Wh_life / LIFEENERGY
                      # flag must be 0 if you upload day-energy Wh_today / DAYENERGY
                      
# Imports for script-operation

import datetime       # used for timestamps & timecheck
import subprocess
from time import strftime
import time

# Linking of parameters

SYSTEMID = pvout_sysid
APIKEY = pvout_apikey
t_date = format(strftime('%Y%m%d'))
t_time = format(strftime('%H:%M'))
Wh_life=LIFEENERGY
Wh_today=DAYENERGY
pv_temp=TEMPINV
pv_volts=VOLTAGE
pv_power=POWER
if pvout_cumflag == 1:
   Wh_upload=Wh_life
else:
   Wh_upload=Wh_today

Starthour = 4
Stophour = 22

# Determine Uploadtime

now = datetime.datetime.now()
print 'Upload-window PVO opens when start-hour =',Starthour
print 'Upload-window PVO closes after stop-hour=',Stophour
uploadtime = (now.hour >= Starthour) and (now.hour <= Stophour)
if uploadtime:
   print 'inside upload-window'
else:
   print 'outside upload-window'

# Determine Values & Compile for upload to PVOutput

if pvout_enabled and uploadtime:
   print 'uploading'
   pv_power=POWER
   pv_temp=TEMPINV
   pv_volts=VOLTAGE
   cum=pvout_cumflag
   cmd=('curl -d "d=%s" -d "t=%s" -d "v1=%s" -d "v2=%s" -d "v5=%s" -d "v6=%s" -d "v10=%s" -d "c1=%s" -H \
   "X-Pvoutput-Apikey: %s" -H \
   "X-Pvoutput-SystemId: %s" \
   http://pvoutput.org/service/r2/addstatus.jsp'\
   %(t_date, t_time, Wh_upload, pv_power, pv_temp, pv_volts, Wh_life, cum, \
   APIKEY, SYSTEMID))
   ret = subprocess.call(cmd, shell=True)

print
print '= Info for PVOutput ='
print 't_date %s' %t_date
print 't_time %s' %t_time
print 'pv_power %s' %pv_power
print 'Wh_today %s'%Wh_today 
print 'Wh_life %s' %Wh_life
print 'Wh_upload %s' %Wh_upload
print 'pv_temp %s' %pv_temp
print 'pv_volts %s' %pv_volts
# --------------------------------------------------
# END OF UPLOAD TO PVOUTPUT
# --------------------------------------------------

Set1 = RPI-B+RFXCom433+S0PCM+Linksprite-shield for BMP180/DS18B20/RS485+DDS238ZN1
Set2 = RPI-3+RFLinkGTW+ESP8266s+PWS_WS7000
Common = 2*PVLogger+PWS_TFA_Nexus+KAKUs
=> Energy & Data Management based on Time and on PV&Consumption&Meteo

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests