Page 1 of 1

Solax Inverter plugin - Help needed

Posted: Thursday 23 November 2023 2:26
by scottydj2
Hi,

I have a Solax X1 inverter with the V3 pocket wifi adapter. The adapter is connected to my guest wifi network, and successfully sends data out to China for the mobile app (Solax Cloud) :shock:

As this is the V3 adapter, I can talk to it locally and request the local data, using curl:

Code: Select all

 curl -d "/?optType=ReadRealTimeData&pwd=PASSWORD" http://192.168.12.215

{"sn":"******","ver":"3.006.04","type":15,"Data":[0,0,0,0,0,0,0,0,0,0,9,26155,0,0,0,0,0,26,10,8691,0,11962,0,6,100,0,0,50,0,0,0,0,64854,65535,47400,0,11879,3,682,0,0,2336,1600,222,180,229,195,32,32,177,1,1,1130,0,28240,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2220,0,63316,65535,0,0,97,0,0,1,0,0,0,0,0,0,360,0,660,0,0,0,0,0,0,13613,5888,5899,1108,778,14649,14649,0,0,0,0,1,2028,0,0,3177,3172,4890,34,20564,12339,18753,12599,16690,12612,14645,20564,12339,18754,12600,16690,12615,14132,20564,12339,18754,12600,16690,12615,12849,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2562,4353,1025,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"Information":[3.680,15,"********",8,1.29,0.00,1.27,1.04,0.00,1]}
I've been trying to get the plugin from this thread viewtopic.php?t=32358 to work.

I've modified the sendData in onConnect to read

Code: Select all

            sendData = { 'Verb' : 'POST',
                         'URL'  : '/?optType=ReadRealTimeData&pwd=PASSWORD',
                         'Headers' : { 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8', \
                                       'Connection': 'keep-alive', \
                                       'Accept': '*/*; charset=UTF-8', \
                                       'Host': Parameters["Address"]+":"+Parameters["Mode1"], \
                                       'User-Agent':'Domoticz/1.0' }
                       }
The connection is made, data is sent, but I seem to get no return data. Debug output is below.

Code: Select all

2023-11-23 01:10:19.018 Solax Inverter: Protocol set to: 'HTTP'.
2023-11-23 01:10:19.018 Solax Inverter: Transport set to: 'TCP/IP', 192.168.12.215:80.
2023-11-23 01:10:19.018 Solax Inverter: Connect directive received, action initiated successfully.
2023-11-23 01:10:19.068 Solax Inverter: Solax connected successfully. Success
2023-11-23 01:10:19.069 Solax Inverter: Sending 226 bytes of data
2023-11-23 01:10:19.069 Solax Inverter: 50 4f 53 54 20 2f 3f 6f 70 74 54 79 70 65 3d 52 65 61 64 52 POST./?optType=ReadR
2023-11-23 01:10:19.069 Solax Inverter: 65 61 6c 54 69 6d 65 44 61 74 61 26 70 77 64 3d xx xx xx xx ealTimeData&pwd=****
2023-11-23 01:10:19.069 Solax Inverter: xx xx xx xx xx xx 20 48 54 54 50 2f 31 2e 31 0d 0a 43 6f 6e ******.HTTP/1.1..Con
2023-11-23 01:10:19.069 Solax Inverter: 74 65 6e 74 2d 54 79 70 65 3a 20 61 70 70 6c 69 63 61 74 69 tent-Type:.applicati
2023-11-23 01:10:19.069 Solax Inverter: 6f 6e 2f 78 2d 77 77 77 2d 66 6f 72 6d 2d 75 72 6c 65 6e 63 on/x-www-form-urlenc
2023-11-23 01:10:19.069 Solax Inverter: 6f 64 65 64 3b 20 63 68 61 72 73 65 74 3d 75 74 66 2d 38 0d oded;.charset=utf-8.
2023-11-23 01:10:19.069 Solax Inverter: 0a 43 6f 6e 6e 65 63 74 69 6f 6e 3a 20 6b 65 65 70 2d 61 6c .Connection:.keep-al
2023-11-23 01:10:19.069 Solax Inverter: 69 76 65 0d 0a 41 63 63 65 70 74 3a 20 2a 2f 2a 3b 20 63 68 ive..Accept:.*/*;.ch
2023-11-23 01:10:19.069 Solax Inverter: 61 72 73 65 74 3d 55 54 46 2d 38 0d 0a 48 6f 73 74 3a 20 31 arset=UTF-8..Host:.1
2023-11-23 01:10:19.069 Solax Inverter: 39 32 2e 31 36 38 2e 31 32 2e 32 31 35 3a 38 30 0d 0a 55 73 92.168.12.215:80..Us
2023-11-23 01:10:19.069 Solax Inverter: 65 72 2d 41 67 65 6e 74 3a 20 44 6f 6d 6f 74 69 63 7a 2f 31 er-Agent:.Domoticz/1
2023-11-23 01:10:19.069 Solax Inverter: 2e 30 0d 0a 0d 0a .. .. .. .. .. .. .. .. .. .. .. .. .. .. .0....
2023-11-23 01:10:19.011 Status: Solax Inverter: Initialized version 1.0.7, author 'EA4GKQ'
2023-11-23 01:10:19.014 Error: Solax Inverter: onStart:
2023-11-23 01:10:19.014 Error: Solax Inverter: if parameters mode 6: 126
2023-11-23 01:10:19.014 Error: Solax Inverter: DumpConfigToLog
2023-11-23 01:10:28.087 Solax Inverter: self.connectedCount --> 0
2023-11-23 01:10:28.087 Solax Inverter: self.httpConn.Connected() --> True
2023-11-23 01:10:28.088 Solax Inverter: self.connectedCount = self.connectedCount +1 0
2023-11-23 01:10:28.088 Solax Inverter: self.httpConn.Connecting() --> False
2023-11-23 01:10:28.088 Solax Inverter: onHeartbeat called, Connection is alive.
2023-11-23 01:10:38.058 Solax Inverter: self.connectedCount --> 1
2023-11-23 01:10:38.058 Solax Inverter: self.httpConn.Connected() --> True
2023-11-23 01:10:38.058 Solax Inverter: self.connectedCount = self.connectedCount +1 1
2023-11-23 01:10:38.058 Solax Inverter: self.httpConn.Connecting() --> False
2023-11-23 01:10:38.058 Solax Inverter: onHeartbeat called, Connection is alive.
2023-11-23 01:10:48.079 Solax Inverter: self.connectedCount --> 2
20
If I remove the leading '/' in the URL to malform the request, I get a 400 Bad request response shown below, so the connection itself seems OK.

Code: Select all

2023-11-23 01:14:01.525 Solax Inverter: Protocol set to: 'HTTP'.
2023-11-23 01:14:01.526 Solax Inverter: Transport set to: 'TCP/IP', 192.168.12.215:80.
2023-11-23 01:14:01.526 Solax Inverter: Connect directive received, action initiated successfully.
2023-11-23 01:14:01.627 Solax Inverter: Solax connected successfully. Success
2023-11-23 01:14:01.636 Solax Inverter: Sending 225 bytes of data
2023-11-23 01:14:01.636 Solax Inverter: 50 4f 53 54 20 3f 6f 70 74 54 79 70 65 3d 52 65 61 64 52 65 POST.?optType=ReadRe
2023-11-23 01:14:01.636 Solax Inverter: 61 6c 54 69 6d 65 44 61 74 61 26 70 77 64 3d xx xx xx xx xx alTimeData&pwd=*****
2023-11-23 01:14:01.637 Solax Inverter: xx xx xx xx xx 20 48 54 54 50 2f 31 2e 31 0d 0a 43 6f 6e 74 *****.HTTP/1.1..Cont
2023-11-23 01:14:01.637 Solax Inverter: 65 6e 74 2d 54 79 70 65 3a 20 61 70 70 6c 69 63 61 74 69 6f ent-Type:.applicatio
2023-11-23 01:14:01.637 Solax Inverter: 6e 2f 78 2d 77 77 77 2d 66 6f 72 6d 2d 75 72 6c 65 6e 63 6f n/x-www-form-urlenco
2023-11-23 01:14:01.637 Solax Inverter: 64 65 64 3b 20 63 68 61 72 73 65 74 3d 75 74 66 2d 38 0d 0a ded;.charset=utf-8..
2023-11-23 01:14:01.637 Solax Inverter: 43 6f 6e 6e 65 63 74 69 6f 6e 3a 20 6b 65 65 70 2d 61 6c 69 Connection:.keep-ali
2023-11-23 01:14:01.637 Solax Inverter: 76 65 0d 0a 41 63 63 65 70 74 3a 20 2a 2f 2a 3b 20 63 68 61 ve..Accept:.*/*;.cha
2023-11-23 01:14:01.638 Solax Inverter: 72 73 65 74 3d 55 54 46 2d 38 0d 0a 48 6f 73 74 3a 20 31 39 rset=UTF-8..Host:.19
2023-11-23 01:14:01.638 Solax Inverter: 32 2e 31 36 38 2e 31 32 2e 32 31 35 3a 38 30 0d 0a 55 73 65 2.168.12.215:80..Use
2023-11-23 01:14:01.638 Solax Inverter: 72 2d 41 67 65 6e 74 3a 20 44 6f 6d 6f 74 69 63 7a 2f 31 2e r-Agent:.Domoticz/1.
2023-11-23 01:14:01.638 Solax Inverter: 30 0d 0a 0d 0a .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. 0....
2023-11-23 01:14:01.688 Solax Inverter: Received 71 bytes of data
2023-11-23 01:14:01.688 Solax Inverter: 48 54 54 50 2f 31 2e 31 20 34 30 30 20 42 61 64 20 52 65 71 HTTP/1.1.400.Bad.Req
2023-11-23 01:14:01.689 Solax Inverter: 75 65 73 74 0d 0a 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 uest..Content-Type:.
2023-11-23 01:14:01.689 Solax Inverter: 74 65 78 74 2f 68 74 6d 6c 0d 0a 43 6f 6e 74 65 6e 74 2d 4c text/html..Content-L
2023-11-23 01:14:01.689 Solax Inverter: 65 6e 67 74 68 3a 20 35 37 0d 0a .. .. .. .. .. .. .. .. .. ength:.57..
2023-11-23 01:14:01.689 Solax Inverter: Received 2 bytes of data
2023-11-23 01:14:01.689 Solax Inverter: 0d 0a .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
2023-11-23 01:14:01.689 Solax Inverter: Received 57 bytes of data
2023-11-23 01:14:01.689 Solax Inverter: 53 65 72 76 65 72 20 75 6e 61 62 6c 65 20 74 6f 20 75 6e 64 Server.unable.to.und
2023-11-23 01:14:01.689 Solax Inverter: 65 72 73 74 61 6e 64 20 72 65 71 75 65 73 74 20 64 75 65 20 erstand.request.due.
2023-11-23 01:14:01.689 Solax Inverter: 74 6f 20 69 6e 76 61 6c 69 64 20 73 79 6e 74 61 78 .. .. .. to.invalid.syntax
2023-11-23 01:14:01.690 Solax Inverter: Disconnect event received for '192.168.12.215:80'.
2023-11-23 01:14:01.690 Solax Inverter: HTTP Details (3):
2023-11-23 01:14:01.690 Solax Inverter: a>'Status':'400'
2023-11-23 01:14:01.690 Solax Inverter: b>'Headers':
2023-11-23 01:14:01.690 Solax Inverter: ----a>'Content-Type':'text/html'
2023-11-23 01:14:01.690 Solax Inverter: ----a>'Content-Length':'57'
2023-11-23 01:14:01.691 Solax Inverter: a>'Data':'b'Server unable to understand request due to invalid syntax''
2023-11-23 01:14:01.691 Solax Inverter: Solax returned a status: 400
2023-11-23 01:14:01.691 Solax Inverter: onDisconnect called for connection to: 192.168.12.215:80
2023-11-23 01:14:01.691 Solax Inverter: Deallocating connection object 'HTTP Test' (192.168.12.215:80).
2023-11-23 01:14:01.384 Status: Solax Inverter: Entering work loop.
2023-11-23 01:14:01.384 Status: Solax Inverter: Started.
2023-11-23 01:14:01.510 Status: Solax Inverter: Initialized version 1.0.7, author 'EA4GKQ'
2023-11-23 01:14:01.513 Error: Solax Inverter: onStart:
2023-11-23 01:14:01.513 Error: Solax Inverter: if parameters mode 6: 126
2023-11-23 01:14:01.513 Error: Solax Inverter: DumpConfigToLog
2023-11-23 01:14:01.660 Error: Solax Inverter: Async Read Exception (192.168.12.215:80): 104, Connection reset by peer
2023-11-23 01:14:01.691 Error: Solax Inverter: Solax returned a Bad Request Error.
2023-11-23 01:14:01.691 Error: Solax Inverter: CConnection_disconnect, disconnection request from 'Solax Inverter' ignored. Transport does not exist.
Any one have any ideas?

Thanks,

Scott.
Going to bed now as I have real work to do in the morning :)