zinen / node-red-contrib-huawei-router

Node-RED node to get information and send commands to Huawei LTE routers.
MIT License
4 stars 1 forks source link

SMS send session error at intervals #13

Closed bajil2203 closed 1 year ago

bajil2203 commented 2 years ago

HI, I am using Huawei 8372 wiggle to send out SMS from a node. The SMS send works okay if trigger is not frequent. But with repeated triggers, pops errors as 125003: Unknown or 125002 : Session. To overcome, used a simple queue to hold the messages and triggers one by one with a delay 10 sec, to 1 minute, The pattern is still the same that after every 2 SMS send successful, there will be 2 errors and following triggers send the SMS for the next 2. Followed by 2 error again. The pattern is same that session error pops out every 2 SMS. Any inputs to resolve this or suggest a workaround will be helpful. Please revert. Thanks Nodered_SMS_error. The issue looks similar to the other post for reading SMS.

bajil2203 commented 2 years ago

Any tips or a workaround will be helpful. Please advise where this session time can be changed or the current value. Appreciate a reply.

zinen commented 2 years ago

Hmm. This could be that the session time of your router does not match the one I tested with. Current session time it clocked at around 300 seconds . And I did not expose this as a setting in router config.

But that should be very possible. I'll require a bit of time to test it though. In the mean time. Could you find the exact limit of your session?

Also what versions are you running? Node. Js, node-red and this node.

grawsom commented 2 years ago

@bajil2203 @zinen I had the same problem when checking for new sms', what I did was mad a new flow where I use the API directly. see here

I have now made a sendSms - you can try that out until node works better.

[{"id":"e90e5caf362b3b81","type":"inject","z":"b1c0d59a0b7da425","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"12345678","payload":"Test test","payloadType":"str","x":170,"y":860,"wires":[["9ee0d80b2a14524c"]]},{"id":"9ee0d80b2a14524c","type":"function","z":"b1c0d59a0b7da425","name":"API - sendSms","func":"var phoneNumber = msg.topic;\nvar message = msg.payload;\n\nlet connection\n//async function sendSms() {\n    try {\n        connection = new huaweiLteApi.Connection('http://admin:admin@192.168.8.1/')\n        await connection.ready\n        const result = await new huaweiLteApi.Sms(connection).sendSms(phoneNumber, message)\n        msg.payload = result\n        \n        console.log('sendSSms result =', result)\n    } catch (error) {\n        console.error('Ended in error:')\n        console.error(error)\n    } finally {\n        const user = new huaweiLteApi.User(connection)\n        // finallyCode - Code block to be executed regardless of the try result\n        const resultLogout = await user.logout()\n        console.log('result from logout=', resultLogout)\n        connection = null\n    }\n//}sendSms()\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[{"var":"huaweiLteApi","module":"huawei-lte-api"}],"x":400,"y":860,"wires":[["57e9f8ca5d86fa46"]]}]
zinen commented 2 years ago

Untested version but with the session timeout accessible as a config. Please try it and give any feedback.

Install node directly as found on github. This does require you the reach the terminal and can not be done from node-red interface.

npm install https://github.com/zinen/node-red-contrib-huawei-router.git#varible-session-timeout
bajil2203 commented 2 years ago

Thanks for the reply. Will test out and feedback on the test status.

Regards

From: zinen @.> Sent: 28 July 2022 18:07 To: zinen/node-red-contrib-huawei-router @.> Cc: bajil2203 @.>; Mention @.> Subject: Re: [zinen/node-red-contrib-huawei-router] SMS send session error at intervals (Issue #13)

Untested version but with the session timeout should now accessible as a config. Please try it and give any feedback.

Install node directly as found on github. This does require you the reach the terminal and can not be done from node-red interface.

npm install https://github.com/zinen/node-red-contrib-huawei-router.git#varible-session-timeout

— Reply to this email directly, view it on GitHubhttps://github.com/zinen/node-red-contrib-huawei-router/issues/13#issuecomment-1198083546, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A2HUCUKIFYSWXDTK6OROQ33VWJ5FTANCNFSM54WTS2NA. You are receiving this because you were mentioned.Message ID: @.**@.>>

bajil2203 commented 2 years ago

Simulated Offline test looks good after changing the session time. However, couldn't find the timeout in the router configuration, but a random trial of 90 secs for now is good for the flow as now. will test out in the field shortly. Really appreciate the support

bajil2203 commented 2 years ago

Hi, The node is not getting registered in newer npm ver 8.x, but in my PC which is running 6.14.15, is working fine. Please advise. thanks.

zinen commented 2 years ago

Bumped to version 1.2.2a aaf2dd9cca1739fca64d17867139e4b28b852b39 may fix this.

zinen commented 2 years ago

Variable session timeout added to main branch in version 1.3.0.