Smsmodem : Binding for SMS on a GSM serial modem

Damn! Cheered too soon … after rebooting, the port is now /dev/ttyUSB0 … so I set the group of ttyUSB0 to dialout (sudo chown root:dialout /dev/ttyUSB0) but now the bridge says, that /dev/ttyUSB0 is no option for the serial port parameter :frowning: . Right now im trying to set the port of the device back to /dev/ttyUSB1 by rebooting to check if the port is the problem.

EDIT: After rebooting several times the modem got the port /dev/ttyUSB1 again and now the bridge goes online with port set to /dev/ttyUSB1 as well as /dev/usb_modem … I’m absolutely clueless why … :frowning:

On Linux, the ttyUSBx assigned is not guaranteed to be the same upon reboot.
Unless you set it with a udev rule.
You can find many tutorials on internet, like this one.

I’m working on a pull request that allow to use symbolic link (human readable brand + model, more stable) created by the kernel in many distribution under /dev/serial/by-id, to simplify thing. But it won’t make it, if accepted, in the next openHAB 3.4 version.
(The JAR bundle I made for you some post ago is able to handle this kind of symbolic link, but not the one currently on the market place)

I know. But I’m surprised, that it works when the modem gets assigned to the port /dev/ttyUSB1, but not when it gets assigned to the port /dev/ttyUSB0, although both ports are set in the EXTRA_JAVA_OPTS configuration and I assigned the group dialout to both ports …

I already defined a udev rule to generate a symbolic link /dev/usb_modem to the actual port and /dev/usb_modem works fine as a parameter in the bridge as long as the real port is /dev/ttyUSB1 … it doesn’t when the port is /dev/ttyUSB0 though …

Wow, OK ! I didn’t get it.
Indeed, it is very strange, and I have absolutely no clue…

I found out, that the connection to the modem does not work at all, when it is connected via ttyUSB0, so it’s not the fault of the binding. I will investigate further and report if I find the reason.

If you keep struggling with default serial port provider, its necessity to allocate other ports then please have a look on this: OH3.X Alternative Java serial provider
For re-assignment of USB identifiers I had another jar which worked with USB device identifiers to provide a reliable port identifiers on top of other serial port providers. I can look for it if you are in testing/fighting mood. :wink:

The serial port provider does not seem to be the problem. Anyway I will try to use gammu again, because I also want to be able to send SMS from my Homematic CCU directly and therefore I need the gammu daemon anyways. Nonetheless I wil report here if I can find the root cause of the problems.

I don’t know if you are aware of this, but with the binding you can have an item linked to send a sms. And as you can send command to item by simple HTTP call, it becomes a one liner for any external system that can send a HTTP call or execute a command line.
(I don’t know if it is relevant and a valid option for the homematic system)

Anyway, gammu is a totally valid choice for your use case.

Sounds like an option, but I want to send SMS in case my smoke detectors signal an alarm. So I want the signaling chain to be as short as possible. In the beginning I didn’t know that I can send messages from the CCU directly. But for sending SMS out of OpenHab, this binding will definetly be my first choice.

I believe this binding is now part of the official 3.4 distribution.

If the version published in the marketplace adds no new features, please unpublish it by removing the appropriate tag,

1 Like

Indeed. I removed the “published” tag.

I have problem with Huawei E3131 on EL8
When I use minicom, modem answer OK. On OH3 I get this error:

2023-04-01 11:37:05.755 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing ‘smsmodem:smsmodembridge:bb9e7b7987’ changed from UNKNOWN to OFFLINE (CONFIGURATION_ERROR): /dev/ttyUSB0 with 9600 is not a valid serial port | baud

user openhab is in group dialup which have permission to device file, baudrate is the same as in minicom

Some hints?

Hello,

This exception is raised when the binding asks from openHAB core the serial port, and openHAB returns nothing. So this is a “global” issue, not directly related to the binding.
(I want to be precise here, because if we cannot manage to help you here, you can ask in the more general part of this community forum)

That said, did you see this openHAB page ? There are other advices to make the serial communication works.

Hello,
I saw this page, but I overlooked /var/lock article.
So for el8 systems is needed add permissions:

chgrp lock /run/lock
chmod g+w /run/lock

and binding running.

Thanks a lot,
PM.

Is planned extension for dialing? For urgent triggers may be usable ringing phone instead notification. ATD command can be easier than SMS.

I didn’t even know it was possible !
It could be very fun to add, especially with the voice/multimedia functionnality of openHAB.
With STT and TTS and dialog processing, you could imagine talking to your openHAB with a simple voice call…
But unfortunately it’s not on the library I use for modem processing, so it means I would have to dig and code this and test… I will add this to my todo/fun list, but let’s be honest, this list is at the moment way too long :sweat_smile:
As usual, anybody is welcome to open a PR and I will be glad to help with testing and reviewing.

I don’t know howto you call AT commands for SMS, but I’d like use dialing only for ringing my phone, and then without voice processing may be work quite easier, maybe simplified as message processing. Ther will be only DIALING, CALL and HANGING signals.

Hi,

first: your Binding is really interesting. Thanks for your work.

I was able to receive SMS with my modem, but I’m not able to send some.
Always I got the following error message:
[WARN ] [rg.smslib.driver.AbstractModemDriver] - /dev/ttyUSB0:4800 ERR==> +CMS ERROR: 500

I tried to change the Baud Rate, the format of the telephone number, but nothing works.

Could you or someone help me?

Regards,
Inc.

Check if your modem knows its IMSI (AT+CIMI=? or AT+CIMI).
Check the SIM card account balance. :slight_smile:

1 Like

WOW, thanks a lot.
You are totally right. It was the balance. In Germany the budget expires, when you put not new money on the account for a year. It works great!