AciDCooL / Domoticz-SolaxCloud-Script

0 stars 2 forks source link

Script problem #2

Closed WBoerhoop closed 4 years ago

WBoerhoop commented 4 years ago

Hi, Still having problems with running the py script,

root@domoticz:~# /usr/bin/python3 /opt/solax/solax.py Traceback (most recent call last): File "/opt/solax/solax.py", line 33, in 'tokenId': tokendata['result']['tokenId'], TypeError: 'NoneType' object is not subscriptable

Can you help me??

AciDCooL commented 4 years ago

tokendata is probly empty, try this on a cmdline where curl is installed:

curl -X POST "http://www.solaxcloud.com:6080/proxy//login/login?password=YOURPASSWORD&userName=YOURUSERNAME&userType=5"

And replace YOURPASSWORD and YOURUSERNAME with your own credentials. it should spit out something like this: {"exception":"成功!","result":{"tokenId":"XXXXXXXXXXX","agreementFlag":1,"userName":"XXXXXX","userId":"XXXXXX"},"success":true}

if its anything else then success then it doesn't accept your username or password. I don't have any checks in place, this script is a really simple implementation. So if there are errors and you know your username and password are correct then maybe there are characters in one of them that need to be escaped. if that is the case then I can only suggest to use a simpler password. I hope this makes any sense if not please do elaborate maybe I have another idea or two :)

AciDCooL commented 4 years ago

I changed the script a bit and you should get a error message explaining what went wrong in chinese from the server. Just translate it through google ;)

WBoerhoop commented 4 years ago

Testing with standard user and password result in 用户名不能为空!
用户名不能为空! =>Username can not be empty! And in the script filled => myusername = 'wboerhoop'

WBoerhoop commented 4 years ago

Changed the password to a simpler password, Et Voila it's works thanks for your help