Ginlong, Omnik Solar, Solarman and Trannergy Inverters Topic is solved

Python and python framework

Moderator: leecollings

PeJeWe
Posts: 56
Joined: Monday 28 November 2016 20:52
Target OS: Raspberry Pi / ODroid
Domoticz version: Latest
Location: Netherlands
Contact:

Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters

Post by PeJeWe »

Toulon7559 wrote: Wednesday 16 November 2022 11:20 @PeJeWe

Which version Solis-inverter do you have?
For my device [= Solis4G700 with Firmware version ME-121001-V1.0.6(201704012008) ] that detected weblink does not work.
However reluctant to change the firmware, because "don't touch a working configuration".
my device is currently off, i think you'll find it in the code below

Code: Select all

Solis s6 gr1p4.6k
sn = 10020402181*****"
sn logger = 40405*****"
Firmware ver = "MW_08_512_0501_1.94";
Toulon7559
Posts: 843
Joined: Sunday 23 February 2014 17:56
Target OS: Raspberry Pi / ODroid
Domoticz version: mixed
Location: Hengelo(Ov)/NL
Contact:

Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters

Post by Toulon7559 »

Revisited the questions for read-out of my Solis 700_4G, either by remote server, or by local server.

Sitrep
1. Remote server, read-out via website
Upload, login and readout via the Website-poratal of the SolisMonitoringSite is/remains without problems.
For readout via Solarman's website with entry via https://home.solarman.cn/login.html the login-info as for Solis2.0 can be used.

2. Remote server, read-out via script
Galadril's script for read-out of the SolisMonitoringSite unfortunately again stopped.
Trying different, similar ones concentrating on Python3-versions, but no luck yet .....

3. Remote server, read-out via Solarman-API
Grover01's read-out via Solarman's API perhaps a better alternative than trying 'repair/upgrade' of Galadril's script?

4. Server_B
Server_B at LAN-stick setup at IP=192.168.0.112, Port 5433 with protocols Solarman_Customer and UDP => reports 'Pingable'.
At 'reading-side' tried to setup with several 'read-out'-scripts at Server_B in Python3,
but probably stuck at the LAN-stick's transmitting function.
Because Wireshark reports, when at the common LAN challenging the interface of the LAN-stick:
Can't get list of interfaces: Is the server properly installed on 198.168.0.112?
connect() failed: no link possible, because the target-computer actively refuses communication. (code 10061)
Freely translated: the LAN-stick and the Server_B/ WireShark see each other, but the LAN-stick blocks communication.
What might be the 'defect' in the setup?
Last edited by Toulon7559 on Sunday 23 April 2023 20:00, edited 1 time in total.
Set1 = RPI-Zero+RFXCom433+S0PCM+Shield for BMP180/DS18B20/RS485+DDS238-1ZNs
Set2 = RPI-3A++RFLinkGTW+ESP8266s+PWS_WS7000
Common = KAKUs+3*PVLogger+PWS_TFA_Nexus
plus series of 'satellites' for dedicated interfacing, monitoring & control.
Toulon7559
Posts: 843
Joined: Sunday 23 February 2014 17:56
Target OS: Raspberry Pi / ODroid
Domoticz version: mixed
Location: Hengelo(Ov)/NL
Contact:

Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters

Post by Toulon7559 »

Today received following message from [email protected]
Might have impact on the various scripts presently used in combination with Domoticz for reading the present Solis_Ginlong Monitoring website.
Dear User,
Solis Home/Pro will be shut down on 30th April 2023. Please download the “SolisCloud” APP or log in to the web version of SolisCloud “www.soliscloud.com” as soon as possible. On the main page of SolisCloud, you can directly log in with the original Solis Home/Pro account password, without any other operation. It is expected that the migration will be completed automatically within 2 hours. If there are still issues after the migration is completed, please contact us at :https://www.ginlong.com/global/contactus.html.
If you already migrated your account and are using SolisCloud, please ignore this email. Thank you for your understanding and support.
Set1 = RPI-Zero+RFXCom433+S0PCM+Shield for BMP180/DS18B20/RS485+DDS238-1ZNs
Set2 = RPI-3A++RFLinkGTW+ESP8266s+PWS_WS7000
Common = KAKUs+3*PVLogger+PWS_TFA_Nexus
plus series of 'satellites' for dedicated interfacing, monitoring & control.
Toulon7559
Posts: 843
Joined: Sunday 23 February 2014 17:56
Target OS: Raspberry Pi / ODroid
Domoticz version: mixed
Location: Hengelo(Ov)/NL
Contact:

Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters

Post by Toulon7559 »

SolisCloud-ReadOut
For the users of the the SOLIS-inverter the transition to the new Cloud-server seems well-supported.
For the manual entry to the new web-portal you can continue using the login-info as for the earlier 2.0-webportal.
Furthermore, for the Cloud-application they provide a general manual (SolisCloud Operation Manual-UserV1.0) and instructions howto get & use the access-info for the API.
First you have to migrate from the Webportal 2.0 to the SolisCloud-server, and
then you have to contact them to request enabling of the API,
after which you get the tab 'API Management' as described in the instruction.
Howto use the API is described in a separate document.
.
Attachments
Solis API Gaining Process.pdf
Howto get Solis API-info
(226.04 KiB) Downloaded 79 times
Solis Home& Pro Shut down Announcement.pdf
Transition to Solis-Cloud
(86.24 KiB) Downloaded 69 times
Last edited by Toulon7559 on Thursday 27 April 2023 23:15, edited 3 times in total.
Set1 = RPI-Zero+RFXCom433+S0PCM+Shield for BMP180/DS18B20/RS485+DDS238-1ZNs
Set2 = RPI-3A++RFLinkGTW+ESP8266s+PWS_WS7000
Common = KAKUs+3*PVLogger+PWS_TFA_Nexus
plus series of 'satellites' for dedicated interfacing, monitoring & control.
Toulon7559
Posts: 843
Joined: Sunday 23 February 2014 17:56
Target OS: Raspberry Pi / ODroid
Domoticz version: mixed
Location: Hengelo(Ov)/NL
Contact:

Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters

Post by Toulon7559 »

SolisCloud-ReadOut
Had the impression that new SolisCloud would now be same as for all other invertertypes related to solarmanpv.com, but that seems mistake.

When trying grover01's script (with line-numbers inserted as reference for fault-finding), filling in with received info for appID and appSecret, the resulting error-message is

Code: Select all

sudo python3 /home/pi/domoticz/scripts/python/Grover01_SolisRead_0185.py
{'code': '2101021', 'msg': 'auth invalid appId', 'success': False, 'requestId': '9c48881b4ef97670'}
Traceback (most recent call last):
  File "/home/pi/domoticz/scripts/python/Grover01_SolisRead_0185.py", line 40, in <module>
    accesstoken = data['access_token']
KeyError: 'access_token'
Looking at contents of the error-message, that traces back to the following lines of the script

Code: Select all

conn.request("POST", "/account/v1.0/token?appId="+appID+"&language=en", payload, headers) # Trannergy call for info
res = conn.getresponse()
data = json.loads(res.read())
print(data) # Test = look at decoded JSON-file
accesstoken = data['access_token']
print("Accesstoken :" +accesstoken)
Needing another setup for the call-string?
In original script under Trannergie-account details see

Code: Select all

apiSite   = "api.solarmanpv.com"
In Solis-key-info received this url-header

Code: Select all

API_Url   = "https://www.soliscloud.com:13333/"
Testingly changed the scriptline below the section for account-settings, which defines the function conn

Code: Select all

# conn      = http.client.HTTPSConnection(apiSite) # Original connection-setup for Trannergy etc.
conn      = http.client.HTTPSConnection(API_Url) # Setup adapted for SolisCloud
The error report now becomes that the port is not recognised.

Code: Select all

http.client.InvalidURL: nonnumeric port: '13333/'
Deleting the portnumber 13333 doesn't help

Code: Select all

Traceback (most recent call last):
  File "/usr/lib/python3.7/http/client.py", line 891, in _get_hostport
    port = int(host[i+1:])
ValueError: invalid literal for int() with base 10: '//www.soliscloud.com'
It more or less confirms that the problem is in the scriptline defining the function conn.
Somebody already solved this puzzle for initial entry to soliscloud?
Last edited by Toulon7559 on Thursday 27 April 2023 23:15, edited 1 time in total.
Set1 = RPI-Zero+RFXCom433+S0PCM+Shield for BMP180/DS18B20/RS485+DDS238-1ZNs
Set2 = RPI-3A++RFLinkGTW+ESP8266s+PWS_WS7000
Common = KAKUs+3*PVLogger+PWS_TFA_Nexus
plus series of 'satellites' for dedicated interfacing, monitoring & control.
Toulon7559
Posts: 843
Joined: Sunday 23 February 2014 17:56
Target OS: Raspberry Pi / ODroid
Domoticz version: mixed
Location: Hengelo(Ov)/NL
Contact:

Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters

Post by Toulon7559 »

SolisCloud-ReadOut
Via a thread inTweakers another solution to read the SolisCloud, and digging there also found a route back to a PHP-solution in Domoticz.
If you want in that Tweaker's Python-script a link to virtual devices in Domoticz, in Github a compatible solution.
Just need to cut&paste&merge all the pieces and then tune&check for your configuration:
that includes some clean-up related to programming errors in the script-examples!

With elements from this solution, must also be possible to tune grover01's 'single_script'-solution for reading SolisCloud.
Set1 = RPI-Zero+RFXCom433+S0PCM+Shield for BMP180/DS18B20/RS485+DDS238-1ZNs
Set2 = RPI-3A++RFLinkGTW+ESP8266s+PWS_WS7000
Common = KAKUs+3*PVLogger+PWS_TFA_Nexus
plus series of 'satellites' for dedicated interfacing, monitoring & control.
njlammerts
Posts: 139
Joined: Wednesday 12 August 2020 17:13
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Fryslan
Contact:

Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters

Post by njlammerts »

I use this script to read directly from my Omnik Inverter and use it for 4-5 years now

https://www.domoticz.com/wiki/Omnik_Solar_Inverter
sulcik
Posts: 1
Joined: Thursday 16 November 2023 20:19
Target OS: Linux
Domoticz version:
Contact:

Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters

Post by sulcik »

Hi to all, im trying to use shinemonitor api and Im really struck on getting company-key ... I did try almost everything, but no success.
Is there any way how to get this number? PLEASE :(


sabiwa wrote: Wednesday 21 April 2021 16:29
sincze wrote: Wednesday 16 August 2017 21:53 I used this script for a while now and it worked perfectly until a week or so. It seems that the www shinemonitor com part is not working anymore. I have tried to find out how to work with the api but I get stuck on the company-key so no avail there. Would love your insights to see how I can get it working again.

Thanks Sabi
underscore4
Posts: 20
Joined: Sunday 19 March 2017 22:06
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters

Post by underscore4 »

Hi,
are you facing problem on the script for ginlong? the link to they platform:10000 seems not getting data and cloud is down. I lost some migration server info? Never got a problem since 2016.....
DomoticzNewbie
Posts: 1
Joined: Monday 20 May 2024 17:37
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Contact:

Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters

Post by DomoticzNewbie »

I am using the script from this post to read data from solarman api. This is working fine. However I get negative values in my energy. I see that every morning around 5 am a negative output is received that is the power generated thew day before. So on sunday my total energy generated was 17,190 according to the solarman portal. In domoticz I see below image at 5 am.

Image

Any ideas wat could be causing this?
Last edited by DomoticzNewbie on Monday 20 May 2024 17:51, edited 1 time in total.
Ouakik
Posts: 1
Joined: Thursday 01 August 2024 22:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters

Post by Ouakik »

Hello,

The Apisite URL has been updated to: "globalapi.solarmanpv.com"
Morevover the structure of the payload is not in line with the documentation.
Now with the routine 3.3 you have more informations. You can use the print of the script if you need more details

In attachement the script updated to take into account the update. It solves the negative value issue.

Thank you for the original code, it helped me a lot!

Code: Select all

#!/usr/bin/env python3

import http.client, urllib.request, json, hashlib
from datetime import datetime

#Trannergy account details
apiSite   = "globalapi.solarmanpv.com"
appID     = "TBD"		#Change to your own appID, to be provided from Trannergy/Solarman
appSecret = "TBD"		#Change to your own appSecret, to be provided from Trannergy/Solarman
email     = "TBD"		#Change to your own account name/mail address
password  = b"TBD"		#Change password to your own, maintain the b in front of the password as password need to be binary

conn      = http.client.HTTPSConnection(apiSite)
password = hashlib.sha256(password).hexdigest()


#domoticz settings
domoticz_host           = "127.0.0.1" #ip adress of the domoticz host
domoticz_port           = "8080"
domoticz_url            = "json.htm"
domoticz_ActualPower    = "TBD" #idx of new device
battery                 = "TBD"
Consumption_Power       = "TBD"
AC_Output_Power         = "TBD"
Grid_Power              = "TBD"
Battery_Power           = "TBD"


#Request access token, manaul chapter/routine 2.1
payload = json.dumps({
  "appSecret": appSecret,
  "email": email,
  "password": password
})
headers = {
  'Content-Type': 'application/json'
}
conn.request("POST", "/account/v1.0/token?appId="+appID+"&language=en", payload, headers)
res = conn.getresponse()
data = json.loads(res.read())
#print (data)
accesstoken = data['access_token']
print("Accesstoken :" +accesstoken)

#Request current power + lastupdate time + stationID, manual chapter/routine 4.4
payload = json.dumps({
  "page": 1,
  "size": 20
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'bearer '+accesstoken
}
conn.request("POST", "/station/v1.0/list?language=en", payload, headers)
res = conn.getresponse()
data = json.loads(res.read())
stationID = str(data['stationList'][0]['id'])
currentpower = str(data['stationList'][0]['generationPower'])
lastupdatetime = int(data['stationList'][0]['lastUpdateTime'])
lastupdatetime = str(datetime.fromtimestamp(lastupdatetime))
print("Current Power :"+currentpower+"W")
print("Last update time :"+lastupdatetime)
print("StationID :"+stationID)

#Request deviceID + deviceSN, manual chapter/routine 4.2
payload = json.dumps({
  "deviceType": "INVERTER",
  "page": 1,
  "size": 10,
  "stationId": stationID
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'bearer '+accesstoken
}
conn.request("POST", "/station/v1.0/device?language=en", payload, headers)
res = conn.getresponse()
data = json.loads(res.read())
print (data)
deviceID = str(data['deviceListItems'][0]['deviceId'])
deviceSN = str(data['deviceListItems'][0]['deviceSn'])
print('Device serial : '+deviceSN)
print('Device ID : '+deviceID)

#Total generated power, manual chapter/routine 3.3
payload = json.dumps({
  "deviceSn": deviceSN,
  "deviceId": deviceID
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'bearer '+accesstoken
}
conn.request("POST", "/device/v1.0/currentData?language=en", payload, headers)
res = conn.getresponse()
print (res)
data = json.loads(res.read())
print (data)
multiply='1000.0'

#Daily Production (Active)
totalgenpower = float(data['dataList'][30]['value']) * float(multiply)
totalgenpower = str(totalgenpower)
print("Total generated power: " +totalgenpower+"W")


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

#Percentage left battery
SoC = int(data['dataList'][48]['value'])
SoC = str(SoC)
print(" Battery: " +SoC+"%")
url = ("http://" + domoticz_host + ":" + domoticz_port + "/" + domoticz_url+ "?type=command&param=udevice&idx=" + battery+ "&nvalue=0&svalue=" +SoC)
urllib.request.urlopen(url)


#Total Consumption Power
Cons_Power = float(data['dataList'][43]['value'])
Cons_Power = str(Cons_Power)
print(" Total Consumption Power: " +Cons_Power+"W")
url = ("http://" + domoticz_host + ":" + domoticz_port + "/" + domoticz_url+ "?type=command&param=udevice&idx=" + Consumption_Power+ "&nvalue=0&svalue=" +Cons_Power)
urllib.request.urlopen(url)


#Total AC Output Power
AC_Power = float(data['dataList'][28]['value'])
AC_Power = str(AC_Power)
print(" AC output Power: " +AC_Power+"W")
url = ("http://" + domoticz_host + ":" + domoticz_port + "/" + domoticz_url+ "?type=command&param=udevice&idx=" + AC_Output_Power+ "&nvalue=0&svalue=" +AC_Power)
urllib.request.urlopen(url)


#Total Grid Power
Grid_Pow = float(data['dataList'][37]['value'])
Grid_Pow = str(Grid_Pow)
print(" Total Grid Power: " +Grid_Pow+"W")
url = ("http://" + domoticz_host + ":" + domoticz_port + "/" + domoticz_url+ "?type=command&param=udevice&idx=" + Grid_Power+ "&nvalue=0&svalue=" +Grid_Pow)
urllib.request.urlopen(url)

#Battery Power
Bat_Pow = float(data['dataList'][47]['value'])
Bat_Pow = str(Bat_Pow)
print("Battery Power: " +Bat_Pow+"W")
url = ("http://" + domoticz_host + ":" + domoticz_port + "/" + domoticz_url+ "?type=command&param=udevice&idx=" + Battery_Power+ "&nvalue=0&svalue=" +Bat_Pow)
urllib.request.urlopen(url)


Sorry if the code does not respect the state of the art, this is one of my first script update

For those who prefer the solution with the rs485 modebus, here a script which helped me.
https://github.com/lambda-ger/sofar-hyd ... te-control

But it is necessary to update it by removing the "write_registers" which is no more usefull. If somebody is interested I can provide my script.
User avatar
galadril
Posts: 824
Joined: Monday 07 September 2015 10:32
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Contact:

Re: Ginlong, Omnik Solar, Solarman and Trannergy Inverters

Post by galadril »

I have a different solar panel inverter currently. So i havent been working on this script.

I did create a python plugin for SolaxCloud lately.
Maybe someone can look at both scripts and create a nice python plugin for Ginlong etc?

https://www.domoticz.com/forum/viewtopic.php?t=42551
Solar panels of Ginlong, Omnik-Solar, Transenergy or Solarman?? Try my Android app:
https://play.google.com/store/apps/deta ... ongmonitor
Post Reply

Who is online

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