Smsmodem : Binding for SMS on a GSM serial modem

I updated the snapshot in the open post to fix the issue with special character.
I also added some tag in this conversation, and the binding should now be available on the openHAB marketplace from within the application.

many thanks - I installed the marketplace version and it’s now receiving messages perfectly. However it’s no longer sending…

The rules DSL code:

val smsAction = getActions("smsmodem","smsmodem:smsmodembridge:huawei")
smsAction.sendSMS(recipient, message)

The result:

 Script execution of rule with UID 'SMS_bridge-1' failed: 'sendSMS' is not a member of 'org.openhab.core.thing.binding.ThingActions'; line 12, column 4, length 37 in SMS_bridge

Strange. I use the same code as you, and it works.
It could be a cache issue, or something like that ?
I remember vaguely having trouble, when I renamed the action from “send” to “sendSMS” in the binding. My rules didn’t work anymore.

Did you delete the JAR in your addon folder ? If you let it and also install it from the marketplace, it could lead to conflict.
Did you restart openHAB ?
Could you clear the cache ? (stop openHAB, clear cache, restart, it could take long) with the “openhab-cli clean-cache” command.

clearing the cache fixed it - thank you! So now 100% working - I’m really grateful.

Hello.
Tried your cool extension! Amazing!

I immediately wrote a bot that receives both control commands and sends the states. It is very convenient when there is no Internet and you need to work with openhab.

But there are a few questions:

  1. Is it possible to send a USSD request, for example, to check the balance?
  2. When sending messages not in Latin, there are no letters in the message (only signs and numbers), But when receiving messages, the extension correctly shows the message. For example, in Ukrainian: “Увага, тривога!” will send " , !" . I would like to be able to choose to send in UCS2 instead of GSM encoding.
  3. And one more strange behavior for me. Delivery report is disabled in extension settings. I send a message and in response (item sate) I receive “Message delivered”, in a conversation with a number (I made an item with a link to the conversation). Can this be turned off or is it sent by the operator?

Hello,

I’m on holidays right now, so I can’t check the code and pay enough attention to answer you precisely. (I will maybe have some time next week)

1- I think I saw in the smslibv4 some way to check the balance. I didn’t use the code because I thought nobody would use it. Sorry, I was wrong ! Do you need the USSD request for other use case ? (honestly, I don’t know exactly what a USSD request is :sweat_smile:). I don’t make any promise, but I will see if I could add the balance check if it is indeed in the original smslibv4 (otherwise, I won’t be able to, because it’s out of my skill)

2- Same as 1. I will check the smslibv4 and will let you know.

3- It has been a long time since I tested the delivery report channel. I think the enable / disable part worked fine. I will test it again ASAP. If I don’t receive delivery report when disabled, then it will be a good indication that it’s linked to your operator.

Just in case : I would like to take the opportunity to mention that, of course, pull requests are welcome if some of you have the knowledge and time :smile:

Hello @maxin,

1- Sorry, but USSD is not supported by the underlying library smslib. USSD AT message DOES exists, so it should also be possible to add it to smslib, but it requires non trivial work and knowlegdge of AT messages protocol, that I don’t have. Pull request welcome :wink:

2- I added an encoding parameter on the conversation thing, and on the action. You can now choose Ucs2. See the updated documentation. The JAR in the open post is also updated.
My tests are OK with your message “Увага, тривога!”, let me know if you have further issue.

3- I don’t know how you could receive such a message. I tested the delivery report, and when it is disabled, my operator doesn’t send anything. I don’t know how to help you on this issue, sorry !

Update procedure : remove and reinstall from the marketplace.
You may have to clear the cache, as I had.

1 Like

Thanks a lot for your attention!

  1. Yes, I understand USSD requests are not a trivial thing. No big deal, just wanted to know if it’s possible to implement.

  2. I’ll check in a few days :grinning:

  3. I don’t know either, just filtering this message :grinning:

Ucs2 option works amazing!!! :heart_eyes:

1 Like

Your extension works great, but there are a few warnings in the logs.

As I understand it, you need to set the correct launch priority or dependency?

2022-06-30 13:52:47.523 [WARN ] [rketplace.MarketplaceBundleInstaller] - The marketplace bundle was successfully installed but doesn't start: Could not resolve module: org.openhab.binding.smsmodem [233]
  Unresolved requirement: Import-Package: org.openhab.core.io.transport.serial

2022-06-30 13:53:53.433 [WARN ] [core.karaf.internal.FeatureInstaller] - The binding add-on 'smsmodem' does not exist - ignoring it.

I am not aware of any requirements defining a “priority” in the start order or something like that. Do you perhaps have some reference document about that ?

I declared the “openhab-transport-serial” feature as a requirement in the feature.xml file.
As far as I know, It is the only thing needed.

I don’t understand how it could work for you with an error message like the one you get :sweat_smile:
Do you use the addon for a direct serial communication, or do you use it to adress a remote dongle on the network (with something like ser2net) ?

I read somewhere on this forum that addon installed by placing a JAR in the addon folder could have trouble getting dependencies. I don’t know if it applies to JAR installed by the marketplace.

)))

  1. Two messages if clear cache and tmp
  2. Last message on every openhab reboot

I don’t know) I just saw in the bundle list that they have priorities.

Hello,

The smsmodem is now merged in the main repository, and will be included in the 3.4 official openHAB version.
Please see the open post for more information (warning : breaking changes in the last release !)

2 Likes

Thank you!

I would recommend to unpublish the binding from the marketplace as soon as OH 3.4 is released. This will avoid confusion for users.

1 Like

Hi,

i tried to install the Binding from the community marketplace. Installtion worked well, but OpenHab logs following error on startup:

2022-12-09 10:45:03.579 [ERROR] [Events.Framework                    ] - FrameworkEvent ERROR
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.smsmodem [264]
  Unresolved requirement: Import-Package: org.openhab.core.io.transport.serial

        at org.eclipse.osgi.container.Module.start(Module.java:463) ~[org.eclipse.osgi-3.17.200.jar:?]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel$2.run(ModuleContainer.java:1847) ~[org.eclipse.osgi-3.17.200.jar:?]
        at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor$1$1.execute(EquinoxContainerAdaptor.java:136) ~[org.eclipse.osgi-3.17.200.jar:?]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1840) ~[org.eclipse.osgi-3.17.200.jar:?]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1783) ~[org.eclipse.osgi-3.17.200.jar:?]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1745) ~[org.eclipse.osgi-3.17.200.jar:?]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1667) ~[org.eclipse.osgi-3.17.200.jar:?]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1) ~[org.eclipse.osgi-3.17.200.jar:?]
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234) [org.eclipse.osgi-3.17.200.jar:?]
        at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:345) [org.eclipse.osgi-3.17.200.jar:?]

Has anyone any clues on whats going wrong?

I heard that there are issues with dependencies installation when using the marketplace.

Do you have another binding using a serial component ?
If not, then I suggest you install one, such as the zwave or zigbee binding.
It could install the serial dependencies and with luck unlock the smsbinding (do not hesitate to stop / start openHAB)

I also saw an old suggestion. You could use this command on the openHAB console :

feature:install openhab-transport-serial

Installing the ZigBee binding first helped. But now the binding doesn’t let me configure a modem. My modem has serial port /dev/ttyUSB0 or /dev/usb_modem (linked). If I try to set the Serial Port to either of these ports, the binding says

{serialPort=Der Wert /dev/ttyUSB0 ist nicht in den erlaubten Optionen enthalten. Erlaubte Optionen sind: [ParameterOption [value=“/dev/ttyS0”, label=“/dev/ttyS0”]]}

which means “The value /dev/ttyUSB0 is not one of the permitted options. Permitted options are: [ParameterOption [value=”/dev/ttyS0", label=“/dev/ttyS0”]]

Any advice?

Hello,

It seems that the openhab serial provider doesn’t recognize your /dev/ttyUSB0 as a serial device. Strange.
So, I just made for you a release that doesn’t enforce the serial property to be a recognized one. The text is now a simple text with no further verification. It will allow you to create the thing. Could you please test it ?

You can download it here and install it in your addon repository. Warning : you have to remove the smsmodem binding installed from the marketplace, otherwise behavior is unknown.

But I’m not very optimistic, if you system doesn’t recognize it as a serial port, it seems dubious that the serial provider can work with it. But it is worth a try anyway.

What is the model of your device ?
Does it work with other similar software, like gammu ?

The binding accepts /dev/ttyUSB0 as a port now, but it now complains about an configuration error (see screenshot).

Sending SMS via gammu works fine and the device is a Huawei E169:

frank@raspberrypi:/usr/share/openhab/addons $ lsusb
Bus 001 Device 005: ID 12d1:1001 Huawei Technologies Co., Ltd. E161/E169/E620/E800 HSDPA Modem
Bus 001 Device 003: ID 0424:ec00 Microchip Technology, Inc. (formerly SMSC) SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Microchip Technology, Inc. (formerly SMSC) SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub