Ginlong, Omnik Solar, Solarman and Trannergy Inverters
Posted: Tuesday 08 September 2015 18:27
EDIT: Script improved by JacquesMulders
EDIT2: Ginlong and MyEvolveCloud.com has now also a new platform (platform 2 they call it). I've added a new script for ginlong on platform 2!!
By default the Ginlong, Omnik Solar, Solarman and Trannergy Inverters can upload all performance values of the inverter to their own portal.
Platform 1
- http://www.ginlongmonitoring.com
- http://www.omnikportal.com
- http://log.trannergy.com
- http://www.tengtengchina.com
- http://www.solarmanpv.com
Platform 2
- http://m.ginlong.com
- http://myevolvecloud.com
PS, if you have a system that now uses Platform 2.0 (with url m.ginlong.com or myevolvecloud.com, look below for a different script!!
All the other staps stay the same, just use a different script.
But with these script, you extract some of that data from that portal to Domoticz.
If you use one of these inverters, please try my Android or iOS app:
Apple:
https://apps.apple.com/nl/app/solar-ene ... 1517272630
Android:
https://play.google.com/store/apps/deta ... ongmonitor
Any ideas?
Prepare Domoticz
If you don't know how to create a virtual sensor chances are you have never done this before.
- Go to "Hardware"
- Fill in the name field with a desired name (like "Virtual")
- Choose for type the "Dummy, does nothing, use for virtual switches only"
- Click on "Add"
- The added hardware is now added to the hardware list. In the same row there is a "Create virtual sensor" button shown. Click on it.
Hardware
Now you are ready to create virtual devices.
- Go to "Hardware"
- Press "Create virtual sensor".
- Fill in the name with a desired name (Ginlong, or Omnik Solar for example)
Devices
Now you are ready to create a devices.
- Go to "Devices"
- Press click on the green arrow at the right on the newly added device.
- Fill in the name field with a desired name
Station ID
Use the stationid.py script to get the station id of your inverter.
You have to config the next parameters in the script:
Ginlong script
Config the parameters in the Ginlong script:
Put the script under /domoticz/scripts and make the script executable:
"sudo chmod +x /home/pi/domoticz/scripts/ginlong.py"
Test
Run the script by calling:
"sudo python /home/pi/domoticz/scripts/ginlong.py"
It should result something like:
Create the Cronjob
Now all ingredients are available to read the data from the portal and insert them into Domoticz.
- execute "sudo crontab -e"
- add the following line "*/5 * * * * /home/pi/domoticz/scripts/ginlong.py"
- exit crontab. Now everything should be working for you.
Scripts
ginlong.py (Platform 1 script)
stationid.py
NEW SCRIPT FOR GINLONG PLATFORM 2::
EDIT2: Ginlong and MyEvolveCloud.com has now also a new platform (platform 2 they call it). I've added a new script for ginlong on platform 2!!
By default the Ginlong, Omnik Solar, Solarman and Trannergy Inverters can upload all performance values of the inverter to their own portal.
Platform 1
- http://www.ginlongmonitoring.com
- http://www.omnikportal.com
- http://log.trannergy.com
- http://www.tengtengchina.com
- http://www.solarmanpv.com
Platform 2
- http://m.ginlong.com
- http://myevolvecloud.com
PS, if you have a system that now uses Platform 2.0 (with url m.ginlong.com or myevolvecloud.com, look below for a different script!!
All the other staps stay the same, just use a different script.
But with these script, you extract some of that data from that portal to Domoticz.
If you use one of these inverters, please try my Android or iOS app:
Apple:
https://apps.apple.com/nl/app/solar-ene ... 1517272630
Android:
https://play.google.com/store/apps/deta ... ongmonitor
Any ideas?
Prepare Domoticz
If you don't know how to create a virtual sensor chances are you have never done this before.
- Go to "Hardware"
- Fill in the name field with a desired name (like "Virtual")
- Choose for type the "Dummy, does nothing, use for virtual switches only"
- Click on "Add"
- The added hardware is now added to the hardware list. In the same row there is a "Create virtual sensor" button shown. Click on it.
Hardware
Now you are ready to create virtual devices.
- Go to "Hardware"
- Press "Create virtual sensor".
- Fill in the name with a desired name (Ginlong, or Omnik Solar for example)
Devices
Now you are ready to create a devices.
- Go to "Devices"
- Press click on the green arrow at the right on the newly added device.
- Fill in the name field with a desired name
Station ID
Use the stationid.py script to get the station id of your inverter.
You have to config the next parameters in the script:
Code: Select all
username = '' #your portal username
password = '' #your portal password
baseURL = 'http://www.ginlongmonitoring.com:10000' #base url
Ginlong script
Config the parameters in the Ginlong script:
Code: Select all
#config
username = '' #your portal username
password = '' #your portal password
baseURL = 'http://www.ginlongmonitoring.com:10000' #base url
stationid = '' #station id, get this via the station python script
#domoticz settings
domoticz_host = ''
domoticz_port = ''
domoticz_url = 'json.htm'
domoticz_ActualPower = '' # idx of new device
Put the script under /domoticz/scripts and make the script executable:
"sudo chmod +x /home/pi/domoticz/scripts/ginlong.py"
Test
Run the script by calling:
"sudo python /home/pi/domoticz/scripts/ginlong.py"
It should result something like:
Code: Select all
Getting Info...
TodayIncome: 1.357
ActualPower: 183
etoday: 5.9
Create the Cronjob
Now all ingredients are available to read the data from the portal and insert them into Domoticz.
- execute "sudo crontab -e"
- add the following line "*/5 * * * * /home/pi/domoticz/scripts/ginlong.py"
- exit crontab. Now everything should be working for you.
Scripts
ginlong.py (Platform 1 script)
Code: Select all
#!/usr/bin/python
import urllib, urllib2, hashlib
from xml.etree import ElementTree as ET
#config
username = '' #your portal username
password = '' #your portal password
baseURL = 'http://www.ginlongmonitoring.com:10000' #base url
stationid = '' #station id, get this via the station python script
# example: Working base urls:
# http://www.ginlongmonitoring.com:10000/
# http://www.omnikportal.com:10000/
# http://log.trannergy.com:10000/
# http://www.solarmanpv.com:10000/
#domoticz settings
domoticz_host = ''
domoticz_port = ''
domoticz_url = 'json.htm'
domoticz_ActualPower = '' #idx of new device
m = hashlib.md5()
m.update(password)
#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
#info url
infoURL = baseURL+'/serverapi/?method=Data&username='+username+'&stationid='+stationid+'&token='+token+'&key=apitest'
print 'Getting Info... '
#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)
#logging values
print 'TodayIncome: '+TodayIncome
print 'ActualPower: '+ActualPower
print 'etoday: '+etoday
print 'etotal: '+etotal
print 'etotal 1000: '+etotalstr
#uploading values to domoticz
url = ("http://" + domoticz_host + ":" + domoticz_port + "/" + domoticz_url+ "?type=command¶m=udevice&idx=" + domoticz_ActualPower+ "&nvalue=0&svalue=" + ActualPower+ ";" + etotalstr)
urllib.urlopen(url)
stationid.py
Code: Select all
#!/usr/bin/python
import urllib, urllib2, hashlib
from xml.etree import ElementTree as ET
#config
username = '' #your portal username
password = '' #your portal password
baseURL = 'http://www.ginlongmonitoring.com:10000' #base url
# Working base urls:
# http://www.ginlongmonitoring.com:10000/
# http://www.omnikportal.com:10000/
# http://log.trannergy.com:10000/
# http://www.solarmanpv.com:10000/
m = hashlib.md5()
m.update(password)
#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
#info url
infoURL = baseURL+'/serverapi/?method=Powerstationslist&username='+username+'&token='+token+'&key=apitest'
print 'Getting station id(s)... '
#login call
infoRoot = ET.parse(urllib.urlopen(infoURL)).getroot()
for elem in infoRoot.findall('power'):
print "StationID: "+elem.find('stationID').text
NEW SCRIPT FOR GINLONG PLATFORM 2::
Code: Select all
#!/usr/bin/python
import requests
import urllib, urllib2
#config
username = 'USERNAME' #your username
password = 'PASSWORD' #your password
domain = 'm.ginlong.com' #domain
plantId = '123456' #plant id
lan = '2' #lanuage (2 = English)
#domoticz settings
domoticz_host = 'DOMOTICZ_USERNAME:DOMOTICZ_PASSWORD@IP'
domoticz_port = '8080'
domoticz_url = 'json.htm' #leave this
domoticz_device_idx = '58'
# Create session for requests
session = requests.session()
#building url
url = 'http://'+domain+'/cpro/login/validateLogin.json'
params = {
"userName": username,
"password": password,
"lan": lan,
"domain": domain,
"userType": "C"
}
#login call
resultData = session.post(url, params=params)
resultJson = resultData.json()
if resultJson['result'].get('isAccept') == 1:
print("Login Succesfull!")
else:
print("Login Failed!!")
Exit()
# Get plant details
url = 'http://'+domain+'/cpro/epc/plantDetail/showPlantDetailAjax.json'
params = {
'plantId': int(plantId)
}
cookies = {'language': lan}
resultData = session.get(url, params=params, cookies=cookies)
resultJson = resultData.json()
TodayIncome = resultJson['result']['plantAllWapper']['plantData'].get('incomeTotal')
ActualPower = resultJson['result']['plantAllWapper']['plantData'].get('power')
etoday = resultJson['result']['plantAllWapper']['plantData'].get('energyToday')
etotal = resultJson['result']['plantAllWapper']['plantData'].get('energyTotal')
multiply='1000.0'
etotal1000 = float(etotal) * float(multiply)
etotalstr=str(etotal1000)
#logging values
print 'TodayIncome: ' + str(TodayIncome)
print 'ActualPower: ' + str(ActualPower)
print 'etoday: ' + str(etoday)
print 'etotal: ' + str(etotal)
print 'etotal 1000: ' + str(etotalstr)
#uploading values to domoticz
url = ("http://" + domoticz_host + ":" + domoticz_port + "/" + domoticz_url+ "?type=command¶m=udevice&idx=" + domoticz_device_idx+ "&nvalue=0&svalue=" + str(ActualPower) + ";" + str(etotalstr))
urllib.urlopen(url)