[smsmodem] Binding for sending and receiving SMS on a GSM serial modem

Hello everyone,

I made a binding to handle SMS with a 3/4/5G serial modem (USB or network exposed), no external dependancy.
This means (theoretically) an easier/faster integration than with an external tool (a.k.a gammu).

The code and documentation is here.
A binary beta version is here.

I will make a pull request in several days. But if someone wants to check, ask for improvement, etc, feel free to do so here.


Fantastic - look forward to trying it!


Sounds very interesting

Which GSM modem are you developing this with?

I have a GSM SMS & VoIP gateway that I use for sending SMS, but I can’t get it to pass incoming SMS back, so your solution is very interesting to me.

Unfortunately, I don’t think your gateway is the kind of hardware this binding address.
It targets devices who supports “AT” command (old phone or USB dongle), either on the computer (as a serial tty), or on the network (BUT also exposed as a serial interface, see ser2net for example).
I use a Huawei E180 (a simple USB dongle) for the development of this binding.

Thanks, that was my understanding.

I’m quite happy to change to a different device.

USB GSM modems are far cheaper and look much better for this application.

I’ve just purchased a (cheap) USB GSM modem, I’ll let you know how I get on.

Oh, right !
I misunderstood your initial question :grinning:

I hope this modem supports AT command.
As the SMS is no more a “central” feature for this kind of device, I know that it is often advised to buy older model. I will try to keep an updated list of functional model on the first post, so please let me know the result of your test :slight_smile:

1 Like

Well this is excellent, thank you! Gammu always felt like a trip back to the 90s; this is so much better.

Works perfectly for me, but two minor bugs.

First, any error messages always refer to "/dev/ttyUSB0’ and not the actual device specified in the Thing (in my case, /dev/usb_modem).

Second, whenever a message is received I get this error in the logs: “ERROR] [way.modem.driver.AbstractModemDriver] - /dev/ttyUSB0:19200 ERR==> +CMS ERROR: 321”

I’m using a huawei E180 (so cheap on ebay these days…)


I’m glad it works for you !

  • the /dev/ttyUSB0 in your log is probably “normal”. Is “/dev/usb_modem” a symlink or an alias or something like that ? The underlying API (smslibv4) need the “real” tty to work with, so I translated symlink to real address. Your error happens too deeply in the code to remember something like a Thing name, which is kept on the openHAB side. Not perfect, I agree with you. But I prefer to let the smslib API handle naming and errors on its own (because it can recover from it, as it seems to do in your case)
  • Here we touch the arcanic world of AT messages…
    Which is a real mess, as manufacturers may have many ways of implementing it. This is even true INSIDE same name modems (I also have a E180 but I could bet it’s different from yours, as I don’t have your error)
    DISCLAIMER : I’m not involved with the smslibv4 api (the discontinued lib that handles the real communication with the modem). I don’t really understand how it works (didn’t try to, and in fact it was what I want : a black box to hide complexity). I patched it for one or two bugs I found with my own USB GSM modem, and also for using a serial library provided by openHAB and not an external dependancy, but that’s all… So, don’t be surprised if I’m not of great help here :sweat_smile:
    This message means we requested an incorrect memory address on the modem (to read or to delete or something else ?)
    If you can give me the full stack trace, I could at least see on what step it occured (on receiving the message, or after that on the delete from the SIM/phone part).
    And if you can put the org.smslib package on debug level I could have the whole exchange of commands and responses and maybe (a very small maybe) see what is wrong.

If this error proves to be not important, I will put this log on the warn level, so you would be able to suppress it without shushing everything else on the package.

Thank you!

How do I get a full stack trace?

My bad, you can’t, I checked the code and there is no stack trace logged in this case.
The debug level on org.smslib should be sufficient though.

Hi, just wondered if you were close to getting this merged? It is excellent!

Due to the code quality requirements in openHAB, I still have some work to do.
In the beta version you tested, I took the smslibv4 code and put it “raw” in the binding.
in order to get the binding merged, I must make many small adjustement for this code to be compliant and of adequate quality. I’m in this process right now, and this is something I clearly haven’t anticipated when I wrote the open post of this topic :sweat_smile:
I’d like to create the merge request in one or two weeks, maybe ? And after this, it could be long, or short if this binding is of any interest to a core maintainer, so I have basically no clue :sweat_smile:

1 Like

cool - thank you!