#šŸš€ New Home Assistant Add-on: SMS-Gammu-Gateway

1 messages Ā· Page 1 of 1 (latest)

tough pier
#

Hey everyone! I wanted to share a project I’ve been working on — a Home Assistant add-on called SMS-Gammu-Gateway.

With the official SMS notifications via GSM modem integration being deprecated, I built this as a replacement. It communicates with GSM modems via Gammu (tested with SIM800L) and exposes both REST API and even MQTT for sending and receiving SMS messages.

It’s perfect for setups where you want SMS alerts for automations or as a backup notification channel when the internet is down. Since it’s a proper HA add-on, it runs smoothly in HAOS environments.

Check it out here: GitHub Repo

Would love to hear your thoughts, feedback, or any ideas for improvements!

GitHub

Contribute to PavelVe/home-assistant-addons development by creating an account on GitHub.

gray badger
#

Thank you for creating such a useful add-on. I just have one concern!
Is it possible, similar to HAOS, to define a device not by using the /dev/ttyUSB* address but instead by referencing the device name like this:

/dev/serial/by-id/usb-1a86_USB_Serial-if00-port0

Because sometimes the ttyUSB address of the modem may change when the server is restarted.

tough pier
#

Of course! You can set that address directly in the add-on configuration. Just replace the /dev/ttyUSB* path with the /dev/serial/by-id/... reference, and the add-on will use it without any problem.

gray badger
#

Great!
I’ll install it and report back on its performance after testing.

gray badger
#

@tough pier
Thanks, everything is correct and working very well.
But I have one problem, and that’s with Unicode messages!
Messages that require Unicode are sent correctly in both the REST API and the Native HA Service methods by adding the line:
"unicode": true

However, in the mqtt.publish method, the line unicode: true is ignored, and the messages are received as ????.

tough pier
gray badger
tough pier
gray badger
#

@tough pier
Is it possible to install the same repository you provided on GitHub (SMS gateway using Gammu) as a container alongside Home Assistant, which is also installed as a container?
If it’s doable, could you please give me some guidance on how to configure its settings?

tough pier
gray badger
tough pier
gray badger
tough pier
#

Hi Meisam,
thanks for your interest. At the moment I don’t plan to develop or maintain anything outside of the Home Assistant add-on ecosystem. My focus is specifically on add-ons for Home Assistant, so I won’t be providing a separate Docker container.

gray badger
tough pier
#

Thanks!

gray badger
#

@tough pier
Hi,
When receiving an SMS, how can I have the sender’s phone number as a sensor?
Also, in the MQTT integration page under Control SMS Gateway, Unicode messages are sent as ā€œ???ā€.

#

If possible, could you please provide a sample automation for receiving a message and forwarding the text along with the sender’s phone number as an SMS, either here or in the add-on documentation?

tough pier
# gray badger <@657884463946006530> Hi, When receiving an SMS, how can I have the sender’s ph...

The sender’s phone number is already part of the state of the sensor sensor.sms_gateway_last_sms_received.
You can extract it from there and, for example, pass it into a helper if you need to use it elsewhere.

Regarding MQTT: it’s not a full replacement for the REST API. Please use the REST API as your primary interface — in Home Assistant you can also create manual sensors based on it. The MQTT integration is only meant to provide some basic functionality and make it easier to work with, but it doesn’t cover everything.

Thanks for your suggestion about expanding the documentation — I’ll consider adding this in the future.

gray badger
#

@tough pier Thanks for your explanation. I actually managed to solve my problem via MQTT as shown in the picture, I was able to both receive the text message and extract the sender’s phone number.
However, I still haven’t been able to achieve this through the REST API.

tough pier
# gray badger <@657884463946006530> Thanks for your explanation. I actually managed to solve ...

That’s really great to hear — you’ve made excellent progress and are already using it exactly the way you need šŸ‘šŸ»

For the REST API part: in Home Assistant you can create a sensor directly from the API using the built-in RESTful Sensor integration https://www.home-assistant.io/integrations/sensor.rest/

Also, the add-on includes a web page with a link to Swagger. There you’ll find examples for all REST API endpoints, and you can even test the requests directly to see how they work.

Home Assistant

Instructions on how to integrate REST sensors into Home Assistant.

gray badger
#

@tough pier
Thanks for your guidance.
I managed to do it, and it’s working really well. šŸ‘ŒšŸ»

#

Installing this Add-on really gave me peace of mind.

I have a question:
Have you tested the add-on with a SIM card modem that is not 2G (for example, a 3G or 4G SIM card modem)?
Do you know of any modem model that is not 2G and also works properly with your add-on?

tough pier
# gray badger Installing this Add-on really gave me peace of mind. I have a question: Have yo...

You’re welcome, I’m glad it’s working well for you! šŸ‘Œ

About your question: the compatibility is not really about 2G, 3G, or 4G. The add-on relies on Gammu, and Gammu works with any modem that provides a standard AT command interface for SMS. So as long as the modem exposes that interface, it should work regardless of whether it’s a 2G, 3G, or 4G device.

The only limitation is that some newer devices act only as ā€œHiLink/router modeā€ without exposing AT commands, and those wouldn’t be supported.

gray badger
tough pier
#

Thanks for your enthusiasm and for doing the research yourself! I really appreciate your questions, especially the first ones that uncover real issues or bugs.

Honestly, at this point I'd suggest checking out the Gammu device database for compatibility details — they’ve done way more testing than I ever could!

I’m happy to help with questions directly related to the add-on itself or genuine bugs, but I can’t provide full technical guidance for hardware choices or things already well documented. Daily ā€œnew questionā€ marathons would quickly wear me out šŸ˜…

Keep up the good work exploring the hardware, and if you run into an actual issue with the add-on, I’ll be glad to dive in!

gray badger
#

@tough pier
The add-on was working fine until yesterday.
Yesterday, I disabled MQTT and added two RestApi sensors: Network and Signal.
Today, the add-on crashed twice, didn’t send any messages, and I had to restart it.
What could be the problem?
Here is the add-on log:

gray badger
#

[10:33:00] INFO: Starting SMS Gammu Gateway...
[10:33:01] INFO: Device path: /dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0
[10:33:01] INFO: Port: 5000
[10:33:01] INFO: Starting SMS Gateway on port 5000...
Gammu machine set for MQTT SMS sending
Successfully initialized gammu with device: /dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0
SIM security status: None
šŸš€ SMS Gammu Gateway v1.3.2 started successfully!
šŸ“± Device: /dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0
🌐 API available on port 5000
šŸ  Web UI: http://localhost:5000/
šŸ”’ SSL: Disabled
šŸ“” MQTT: Disabled
āœ… Ready to send/receive SMS messages

  • Serving Flask app 'run'
  • Debug mode: off
    āŒ Gammu operation 'GetNetworkInfo' failed: {'Text': 'No response in specified timeout. Probably the phone is not connected.', 'Where': 'GetNetworkInfo', 'Code': 14}
    Exception on /status/network [GET]
    Traceback (most recent call last):
    File "/usr/lib/python3.11/site-packages/flask/app.py", line 917, in full_dispatch_request
    rv = self.dispatch_request()
    ^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/lib/python3.11/site-packages/flask/app.py", line 902, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/lib/python3.11/site-packages/flask_restx/api.py", line 402, in wrapper
    resp = resource(*args, **kwargs)
    ^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/lib/python3.11/site-packages/flask/views.py", line 110, in view
    return current_app.ensure_sync(self.dispatch_request)(**kwargs) # type: ignore[no-any-return]
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/lib/python3.11/site-packages/flask_restx/resource.py", line 41, in dispatch_request
    resp = meth(*args, **kwargs)
    ^^^^^^^^^^^^^^^^^^^^^
    File "/usr/lib/python3.11/site-packages/flask_restx/marshalling.py", line 244, in wrapper
#

During the time this happens, the Network Name and signal power are shown as unavailable.
I realized that if I don’t restart the add-on myself, it apparently restarts automatically after about 3 minutes.

gray badger
#

@tough pier Doesn’t your add-on have the ability to send multiple SMS messages at short intervals?
When it tries to send several SMS messages, it gives an error and only sends the first one. The following messages are either sent after a one-minute delay or not sent at all.

Whereas, when I use the same dongle with Home Assistant’s built-in gsm-modem integration, it sends SMS messages simultaneously to multiple different numbers without any limitation.

tough pier
#

That’s great that the add-on restarts automatically after a crash, thanks for testing it. I haven’t tried sending multiple SMS messages in a short interval. I only wrapped the repository https://github.com/pajikos/sms-gammu-gateway
into an add-on and added some extra features, but the internal logic comes directly from that repository. Adding a small delay between sending SMS messages might help.

GitHub

Simple SMS REST API gateway for sending SMS from gammu supported devices - pajikos/sms-gammu-gateway

gray badger
#

@tough pier
Thank you for your guidance. Just like in the MQTT section where it was ignoring unicode: true and you fixed it, it seems that sending messages to multiple numbers in MQTT also doesn’t work with the format mentioned in the documentation.