Closed grawsom closed 2 years ago
@grawsom well we do support encrypted requests for some endpoints, see:
So you may try to modify https://github.com/Salamek/huawei-lte-api/blob/214ddbf4f756f45ca6e9a1e8226de3be879d0ed1/huawei_lte_api/api/Sms.py#L85 to use is_encrypted=True
and try if that changes anything...
And looks like this is related to https://github.com/Salamek/huawei-lte-api-ts ? i did not implement encryption there yet, so pls try it with this library, and if it works i will port it to TS version.
I'm not that well in i py (not a programmer), but I will try to see if I can get some stuff running. :-)
SUCCES :-)
I did this in windows, but are going to try this on my pi, hopefully tomorrow, as I said I'm no programmer, but Google is my friend.
Installed python 3, did the pip install as described in Readme, then used the send_sms from examples with correct data, and I got "SMS was send succesfully" - and of cause also received on phone.
And did not change anything in the files regarding is_encrypted=True
Don't know yet if I can use the py API with modules in Node-Red, but else will I be waiting for the port to TS/js. So now I can continue my project, and also maybe "zinen" that made the node-red package will happy to.
@grawsom so this library works for you without any mods?
@Salamek Yes, and I have also just tested on a clean Raspberry installed with (bullseye v. 11) - did test it with the send_sms.py, and device_info.py and working just fine - so looking forward to the TS update :-)
@grawsom ok, that is great and weird since huawei-lte-api-ts should be working for you too (sms code logic should be identical just written in different language)
@Salamek do we have examples in the TS package as in the Python package, maybe I could start there and not what I get from the other - maybe my script was wrong.
@grawsom i have added some examples to TS version just for you see https://github.com/Salamek/huawei-lte-api-ts/tree/master/examples
@Salamek Device_info.js is working fine, but still get an error with the send_sms.js I did put in some console.log for argument [2], [3] and [4], so I was sure of the parsing. Here is log output Ready http://admin:admin@192.168.8.1/ +45XXXXXXXX (replaced my phonenumber with XX) Hello world ResponseErrorException: 100005: Unknown at new ResponseErrorException (/home/pi/.node-red/node_modules/huawei-lte-api/dist/exceptions.js:20:28) at Connection.checkResponseStatus (/home/pi/.node-red/node_modules/huawei-lte-api/dist/Connection.js:157:19) at /home/pi/.node-red/node_modules/huawei-lte-api/dist/Connection.js:296:54 at processTicksAndRejections (internal/process/task_queues.js:95:5) { code: 100005
@grawsom hmm there must be something different in request data that your router does no like...
I have tested what is the difference between Python
and TypeScript
version:
TypeScript
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<request>
<Index>-1</Index>
<Phones>
<Phone>+420XXXXXXXXX</Phone>
</Phones>
<Sca/>
<Content>Ahoj2</Content>
<Length>5</Length>
<Reserved>1</Reserved>
<Date>2021-12-20 16:25:22</Date>
</request>
Python
<?xml version="1.0" encoding="utf-8"?>
<request>
<Index>-1</Index>
<Phones>
<Phone>+420XXXXXXXXX</Phone>
</Phones>
<Sca></Sca>
<Content>Ahoj2</Content>
<Length>5</Length>
<Reserved>1</Reserved>
<Date>2021-12-20 19:01:33</Date>
</request>
So, as you can see there is difference in how Sca
is handled and some data added in XML header... since Huawei XML parser is shitty AF, it is possible that this is our issue... so lets try to first change Sca
So pls, update to huawei-lte-api-ts 0.0.8 and try again
@Salamek I have now tested on windows and raspberry - with no luck. I also played with wireshark to see differences, and I don't think it's the xml header, more to belive the way with credintials.
I have saved files from wireshark, maybe you can get some out of them.
CENSORED URL
I also found an script that works, see if can help someway.
@grawsom try 0.0.9 pls
@Salamek Sorry - No change.
Here is the output
Ready ResponseErrorException: 100005: Unknown at new ResponseErrorException (C:\Users\ivans\.node-red\node_modules\huawei-lte-api\dist\exceptions.js:22:28) at Connection.checkResponseStatus (C:\Users\ivans\.node-red\node_modules\huawei-lte-api\dist\Connection.js:168:19) at C:\Users\ivans\.node-red\node_modules\huawei-lte-api\dist\Connection.js:308:54 at processTicksAndRejections (node:internal/process/task_queues:96:5) { code: 100005 }
I have again made some wireshark saves, (send_sms.js, device_info.js) and the working sh script (script.sh) 0.0.9.zip
@grawsom #17 by @icetee fixes this issue, just tested on my 3372h-320 (i remembered i have like a week ago lol) So pls install 0.0.10 to test
Why I'm writing here is because I wanted to use the 3372 in Node-red, and this one have made a Node-red package that uses you API - but.
Seems like the 3372h-320 need some encryption when doing some sms stuff, for me it's send-sms.
Maybe this one could help, because the send-sms works with this package, and what I can see is that in the source is some
<nonce>${encrpt}</nonce>
after date in the URL when calling the API.If I can help some way in testing with my device I'm here :-)