I now have three zones active, a PIR, vibration sensor and a reed switch. When I trigger all three zones at around the same time, I noticed that the first alarm SMS gets sent straight away, but the additional ones take some minutes to get through. I thought at first it was just my mobile network but actually the Gatway seems to delay sending them. I've included some debug below with the approximate time stamps, according to the Gateway clock.
Alert: ZP, Flags: 1, Text: Zone 1 PIR Ground alarm <--- Approx 20:37 hrs SMS begin: 1 SMS end: 1 SMS begin: 1 -PB-connection: 536937116 -PD-connection: 536937116 p->payload: 'N=Now' -PE-connection: 536937116 Parse: N = 'Now' (3) -PE-response_uri: /log.html ch> ch> ch> SMS end: -11 SMS begin: 1 SMS end: -11 Alert: ZP, Flags: 1, Text: Zone 2 Smash Slide Gnd alarm <--- Approx 20:41 hrs SMS begin: 1 SMS end: 1 SMS begin: 1 ch> ch> SMS end: -11 SMS begin: 1 SMS end: -11 Alert: ZP, Flags: 1, Text: Zone 3 Entry Slide Gnd alarm <--- Approx 20:43 hrs SMS begin: 1 RS485: 2048, 8-3 |
Administrator
|
Hello,
that is actually the network delay. The alert is queued for processing. As gateway has only one modem, it can do only one SMS at a time. So alert queue sees incoming: Alert: ZP, Flags: 1, Text: Zone 1 PIR Ground alarm <--- Approx 20:37 hrs SMS begin: 1 SMS end: 1 I one successful SMS. I guess you have 3 numbers defined to receive the SMS? Since for same alert there is: SMS begin: 1 SMS end: -11 And then again: SMS begin: 1 SMS end: -11 Only then the new alert is processed, again to three numbers. Alert: ZP, Flags: 1, Text: Zone 2 Smash Slide Gnd alarm <--- Approx 20:41 hrs SMS begin: 1 SMS end: 1 SMS begin: 1 SMS end: -11 SMS begin: 1 SMS end: -11 The "SMS end: -11 " is actually timeout reached, waiting for network ACK. Modem is waiting for network ACK of SMS being sent. This does not mean that the SMS is not sent, only that modem did not get the network ACK. Do you really have 3 users defined as recipients? |
Hi Adam, yes I have three users defined with three numbers. Actually, I think two of them are disabled currently, so they don't receive the messages.
|
Administrator
|
Hello Charles,
there is a check if user is enabled and member of group, so this should be covered. I've check, maybe good approach is to change the modem behavior to not to wait for GSM network ACK, and simply go on. I have briefly looked and It should be possible. Adam |
I checked and although I have three users, only one is enabled that is configured to send SMS messages. Would it be possible to have a timer going so that it waits 20 seconds for an ACK, and then continues anyway after the timeout? The engineer in me thinks is might cauese issues later on if we don't wait for the ACKs and start queuing stuff immediately.
|
Administrator
|
The enable/disable works here on my side. Just tried with me, defining myself 3 times with same number.
There is actually a timer, that is why you see the delay. It is set to 50 seconds to wait for ACK. If not received you see SMS end: -11. Let me guess. The users are enabled but the phone number is empty? |
One user is enabled with phone number (me), the second has a number but disabled, and the third is enabled but no number, as you say.
|
Administrator
|
In reply to this post by vysocan
Yes OK, it is the malformed or empty phone number causing this. Modems send this wrong phone number to network and waiting for ACK which never comes.
I'll add a isPhoneNumer function to check at least for format and length. Let's assume phone number is at least 9 chars and consists of "0123456789+". |
Administrator
|
Hello Charlie,
I've pushed new build, can you check? |
This post was updated on .
I just tested and it works great :) SMS messages received straight away.
|
Administrator
|
Great, and thanks for feedback.
|
Administrator
|
Hello Charles,
what's your opinion on adding an extra alert channel like: * https://pushover.net/ * https://www.pushsafer.com/ that would allow push notification to mobile and/or desktop. Both of them are of course external and also paid services. Pushover wants $5 USD for one device for a lifetime. While pushsafer is paid by sent notification (1000 for 1 EUR, 20000 for 10EUR). Or maybe even adding: https://slack.com Adam |
Hi Adam,
Sorry for delay in responding, I only just saw this when I came to post a different comment :) I would say that I prefer to avoid using commercial services like these, as often they are proprietary and don't stick around for the long term. I wonder if it's possible to have a flexible API, so that the OHS could make a RESTful API request to send an SMS? I did a quick search and can see they are fairly common, something like: curl -X POST -H 'Authorization: token U51U9KhRl0t53n9W' -i 'http://server.address/api/sms/send' --data '{ "to": "1234567890", "from":"9876543210", "content":"Hello world!" }' |
Administrator
|
I guess it is possible. There is not real operating system, so no curl, but sending JSON is possible. That would be the interface to APIs mentioned by me anyway.
But then my question would be why would you want to have another SMS channel? I trust more the hardware modem then API over network. I would prefer other then already existing SMS. I some more Push services: * https://www.pushbullet.com/ 100 free per month, then 4 USD a month. * https://gotify.net/ - Free and open source, needs self hosting on server. Has Android only app. I tried installation on my server. Just downloaded a package and run. To tell you background, my intention was at first was to create an API to Telegram chat bot. This way gateway can send events to group chat. And maybe some time later also gateway is able to receive commands from Telegram chat (Old gateway was able to receive SMS from user to reply also via SMS). But the encryption required by Telegram is very strong, and sending a JSON takes around 12 seconds. Most of time the gateway is creating diffie hellman private key for TLS. Now I'm in investigation how this can be speeded up. |
I was thinking that TLS will be a challenge. It's occuring more and more in the IoT world where devices need to use secure communications, but don't have much horsepower to do the calculations :) We are lucky that you chose a platform that is at least capable.
Regarding the curl command, I included it just as an example, and perhaps you could have a generic north-bound API that would interface with any RESTful platform such as these message forwarders. You could have a configurable address, port, security (TLS I guess) and then a free text where to enter the JSON. I guess it would be a POST most of the time. I definitely don't want to repalce the GSM modem, as that is something that always works for me, and although I guess does use a 'cloud' of sorts (the mobile network) I think of it as much more reliable than the web. |
Administrator
|
Creating some sort of user configured JSON parser will be a challenge. Now I'm trying to choose what might be best. Some sort of push service would be nice. Telegram was my choice, but their requirements for crypto suites are very strong (ECC, DH), while all other push services still allows something like RSA, which is pretty doable. Some push services even still allow TSL 1.0 and 1.1.
The interface vary as you imagine, even sometimes they require POST, but sometime GET to push a message. https://gotify.net seems to be most appropriate as it is open source, but require self hosting. |
Hi Adam,
The gotify looks interesting but I guess it's use would be limited to those willing to self-host. I have a raspberry Pi running stuff that I could use, but I suspect most people wouldn't want to have to run a seperate server. I was wondering about the Signal messenger protocol, is it too resource hungary perhaps? I guess any push notification system will either be proprietary or rely on some hosting service, either self-hosted or cloud based. |
Administrator
|
Nice. I've checked Signal, quite nice messenger, but it looks even more complex then Telegram. Encryption is at least same as Telegram and it does not have API. It would require to implement it's protocol.
|
Free forum by Nabble | Edit this page |