Ginlong solar inverter scrape

Here's an example flow for collecting plant and inverter data from the new ginlong monitoring website. http://m.ginlong.com I had a previously used ginlongmonitoring.com but that is being replaced by the newer website. I had to re-register for m.ginlong.com, and then enter the serial number for my inverter's wifi stick - after half an hour the new dashboard was populated with data.

The new website is easy to parse and pull data from - it provides a number of json feeds.

The LoginDetails node should be edited to include your login username and password for the new ginlong website.

The final function node should be edited to set the appropriate Domoticz idx values. My inverter has two input strings if you have a different amount you should edit appropriately. If you're not posting out to Domoticz, edit as appropriate.

The msg in the final function has accumulated several properties which hold interesting data: msg.plantData msg.inverterData msg.inverterDetails

Hope this is useful.

[{"id":"a806f317.5b159","type":"tab","label":"Flow 1"},{"id":"40eb6db4.c50e84","type":"inject","z":"a806f317.5b159","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":120,"y":80,"wires":[["7a0978b4.a648a8"]]},{"id":"4fe73d72.8d6244","type":"http request","z":"a806f317.5b159","name":"login","method":"use","ret":"obj","url":"","tls":"","x":470,"y":80,"wires":[["219d3c99.1cedb4"]]},{"id":"6ffe7cc2.7458a4","type":"debug","z":"a806f317.5b159","name":"","active":false,"console":"false","complete":"true","x":750,"y":340,"wires":[]},{"id":"7a0978b4.a648a8","type":"function","z":"a806f317.5b159","name":"Login Details","func":"msg.url='http://m.ginlong.com/cpro/login/validateLogin.json';\nmsg.method =  'POST';\nmsg.headers = {};\nmsg.headers['Content-Type']='application/x-www-form-urlencoded';\nmsg.payload = {};\nmsg.payload['userName']='*** ENTER USER NAME HERE ***';\nmsg.payload['password']='*** ENTER PASSWORD HERE ***';\nmsg.payload['lan'] = '2';\nmsg.payload['domain']='m.ginlong.com';\nmsg.payload['userType']='C';\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":80,"wires":[["4fe73d72.8d6244"]]},{"id":"8fa78735.116bb8","type":"http request","z":"a806f317.5b159","name":"get Inverter details","method":"POST","ret":"obj","url":"","tls":"","x":470,"y":260,"wires":[["aeed5c2a.aca92"]]},{"id":"e225c82f.3474e8","type":"http request","z":"a806f317.5b159","name":"get Plant list","method":"use","ret":"obj","url":"","tls":"","x":450,"y":140,"wires":[["d2d3f871.c2d388"]]},{"id":"219d3c99.1cedb4","type":"function","z":"a806f317.5b159","name":"","func":"msg.url='http://m.ginlong.com/cpro/epc/plantview/view/doPlantList.json';\nmsg.method =  'POST';\nmsg.headers = {};\nmsg.headers['Content-Type']='application/x-www-form-urlencoded';\nmsg.payload = {};\nmsg.cookies = {};\nmsg.cookies = msg.responseCookies;\nreturn msg;","outputs":1,"noerr":0,"x":310,"y":140,"wires":[["e225c82f.3474e8"]]},{"id":"cb846210.ae6a8","type":"http request","z":"a806f317.5b159","name":"get Inverter list","method":"use","ret":"obj","url":"","tls":"","x":460,"y":200,"wires":[["691332e1.2034fc"]]},{"id":"d2d3f871.c2d388","type":"function","z":"a806f317.5b159","name":"","func":"\nmsg.plantData = msg.payload.result.pagination.data[0];\n\nmsg.url=\"http://m.ginlong.com/cpro/epc/plantDevice/inverterListAjax.json?orderBy=updateDate&orderType=2&pageIndex=1&plantId=\"+msg.plantData.plantId+\"&sequenceNum=9&showAddFlg=1\";\nmsg.method =  'GET';\nmsg.headers = {};\nmsg.headers['Content-Type']='application/x-www-form-urlencoded';\nmsg.payload = {};\n\nmsg.cookies = {};\nmsg.cookies = msg.responseCookies;\nreturn msg;","outputs":1,"noerr":0,"x":310,"y":200,"wires":[["cb846210.ae6a8"]]},{"id":"691332e1.2034fc","type":"function","z":"a806f317.5b159","name":"","func":"\nmsg.inverterData = msg.payload.result.paginationAjax.data[0];\n\nmsg.url='http://m.ginlong.com/cpro/device/inverter/goDetailAjax.json';\nmsg.method =  'POST';\nmsg.headers = {};\nmsg.headers['Content-Type']='application/x-www-form-urlencoded';\nmsg.payload = {};\nmsg.payload['deviceId']=msg.inverterData.deviceId;\n\nmsg.cookies = {};\nmsg.cookies = msg.responseCookies;\nreturn msg;","outputs":1,"noerr":0,"x":310,"y":260,"wires":[["8fa78735.116bb8"]]},{"id":"aeed5c2a.aca92","type":"function","z":"a806f317.5b159","name":"","func":"msg.inverterDetails = msg.payload.result.deviceWapper.dataJSON;\n\nmsg.pv1 = {};\nmsg.pv1['Voltage'] = msg.inverterDetails['1a'];\nmsg.pv1['Current'] = msg.inverterDetails['1j'];\nmsg.pv1['Power'] = msg.pv1.Voltage * msg.pv1.Current;\n\nmsg.pv2 = {};\nmsg.pv2['Voltage'] = msg.inverterDetails['1b'];\nmsg.pv2['Current'] = msg.inverterDetails['1k'];\nmsg.pv2['Power'] = msg.pv2.Voltage * msg.pv2.Current\n\nvar msgout1 = {};\nmsgout1.payload= { svalue:msg.pv1.Power.toString(),nvalue:0, idx:292};\nvar msgout2 = {};\nmsgout2.payload= { svalue:msg.pv1.Voltage.toString(),nvalue:0, idx:290};\nvar msgout3 = {};\nmsgout3.payload= { svalue:msg.pv1.Current.toString(),nvalue:0, idx:297};\nvar msgout4 = {};\nmsgout4.payload= { svalue:msg.pv1.Current.toString(),nvalue:0, idx:291};\n\nvar msgout5 = {};\nmsgout5.payload= { svalue:msg.pv2.Power.toString(),nvalue:0, idx:293};\nvar msgout6 = {};\nmsgout6.payload= { svalue:msg.pv2.Voltage.toString(),nvalue:0, idx:294};\nvar msgout7 = {};\nmsgout7.payload= { svalue:msg.pv2.Current.toString(),nvalue:0, idx:298};\nvar msgout8 = {};\nmsgout8.payload= { svalue:msg.pv2.Current.toString(),nvalue:0, idx:295};\n\nvar msgout9 = {};\nvar today = msg.inverterData.energyToday * 1000;\nmsgout9.payload= { svalue:msg.inverterData.powerTotal.toString()+';'+today.toString() ,nvalue:0, idx:296};\n\n\n\nreturn [[msgout1, msgout2, msgout3, msgout4, msgout5, msgout6, msgout7, msgout8, msgout9],msg];","outputs":"2","noerr":0,"x":610,"y":320,"wires":[["4519c208.5d4c8c"],["6ffe7cc2.7458a4"]]},{"id":"e8258e5f.cee0f","type":"mqtt out","z":"a806f317.5b159","name":"","topic":"domoticz/in","qos":"","retain":"","broker":"928ee60e.fd30a8","x":950,"y":260,"wires":[]},{"id":"4519c208.5d4c8c","type":"delay","z":"a806f317.5b159","name":"","pauseType":"rate","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"2","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":760,"y":260,"wires":[["e8258e5f.cee0f"]]},{"id":"928ee60e.fd30a8","type":"mqtt-broker","z":"","broker":"localhost","port":"8883","tls":"","clientid":"","usetls":true,"compatmode":true,"keepalive":"15","cleansession":true,"willTopic":"","willQos":"0","willRetain":"false","willPayload":"","birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":""}]

Flow Info

Created 5 years, 8 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • debug (x1)
  • delay (x1)
  • function (x5)
  • http request (x4)
  • inject (x1)
  • mqtt out (x1)
  • mqtt-broker (x1)
Other
  • tab (x1)

Tags

  • Ginlong
  • solar
  • inverter
  • domoticz
  • solis
  • mqtt
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option