BlazejosP / huawei-sun2000-API-CLI

Huawei SUN2000 compatible devices which working with Huawei Cloud Service command line bash API for monitoring or download data from their FusionSolarApp API
https://www.buymeacoffee.com/blazejosP
GNU General Public License v3.0
110 stars 15 forks source link

Different Huawei setup configurations from Kisoskmode.sh post your own here #3

Closed BlazejosP closed 3 years ago

BlazejosP commented 3 years ago

Anyone has configuration where is something more than just inverter. That is my [+] Inverter Huawei SUN2000-M0 [-] Energy battery Storage LG Chem HV or Huawei LUNA [-] Smart Power Sensor (DDSU666-H) [-] Solar radiation sensor [-] SmartLogger 3000

So I'm curious what types of data are available if you have some of this additional devices in your setup like for example DDSU666-H look on lines 226 to 274 in kioskmode.sh they are based on assumptions so will be great if someone can provide real data
for a while from one of such devices and will be possible put inside this lines real code which can grab additional data.

lwodniak commented 3 years ago

I only use it for 'domoticz'. For now, I have it done quite simply. The SSH script that runs the python script inserts the data into the domoticz for daily and current use. I have a crontab set up every 2 minutes.

`import requests import json import decimal userName=.... systemCode=....

s = requests.Session() s.headers.update({'Connection': 'keep-alive', "Accept": "/","Accept-Encoding": "gzip,deflate,sdch", 'Content-Type': 'application/json'}); r = s.post(url='https://eu5.fusionsolar.huawei.com/thirdData/login', json={"userName":userName,"systemCode":systemCode},headers=s.headers) data=r.json() cook= r.cookies.get(name='XSRF-TOKEN')

s.headers.update({'Connection': 'keep-alive', "Accept": "/","Accept-Encoding": "gzip,deflate,sdch", 'Content-Type': 'application/json', 'XSRF-TOKEN': cook}) r = s.post(url='https://eu5.fusionsolar.huawei.com/thirdData/getStationList', json={},headers=s.headers) data=r.json() sc=data['data'][0]['stationCode']

r = s.post(url='https://eu5.fusionsolar.huawei.com/thirdData/getDevList', json={"stationCodes":sc},headers=s.headers) data=r.json() devIds=data['data'][0]['id']

r = s.post(url='https://eu5.fusionsolar.huawei.com/thirdData/getDevRealKpi', json={"stationCodes":sc,"devIds":devIds, "devTypeId":"1"},headers=s.headers) data=r.json() dane=data.get("data")[0] print(decimal.Decimal(dane.get("dataItemMap").get("active_power"))1000) print(decimal.Decimal(dane.get("dataItemMap").get("day_cap"))1000) url = "http://192.168.1.150/json.htm?type=command&param=udevice&idx=190&nvalue=0&svalue="+str(decimal.Decimal(dane.get("dataItemMap").get("active_power"))*1000)+';'+str(int(decimal.Decimal(dane.get("dataItemMap").get("day_cap"))*1000)) s3 = requests.Session() r = s3.get(url=url) `