Send SMS with USB GSM modem when alarm triggered

Twilio is very affordable. See my post about Twilio costs here.

The SIM is tied to my Twilio account, and the phone number is purchased separately in my Twilio account. So, I can cancel the SIM whenever I’d like, but keep the number so I can still place calls over the internet without a SIM. For sending SMS with a SIM, configuration is simple. Just use the SMS integration configuration. Otherwise, you can send Twilio SMS over the internet.

With Twilio, you can also use the Twilio Call integration, as seen here. Only, with a SIM card, you have to add the “device” to your configuration.

I don’t understand this setup, is this using the internet to send SMS?
Can you elaborate more?

Sure. I have a Twilio account (referral code in link, if you’d be so kind), in which I have subscribed to a phone number for $1/mo and a SIM for $2/mo. The account is prepaid, funded with a credit card, and I have it setup such that a balance of less than $10 will top it back up to $20.

The Twilio SIM is in my Huawei E3372h-510 (flashed with serial firmware) and is configured with the SMS integration. It can send an SMS to my cell phone like any SIM. Twilio uses the T-Mobile network in the US. The cost is 0.01 per message, it seems. So, if I send 100 messages per month, my Twilio costs for the month are $1 for the phone number + $2 for the SIM + (100 messages x $0.01) = $4.

Twilio also offers a text-to-speech telephone call service, for which there is a HA integration. After achieving success with the SMS integration over an Internet connection, my next objective was to setup this Twilio Call integration to place calls via the Huawei modem. It worked fine over the Internet, but my intent is to use my RPi in a location that has no Internet connection, so event tiggers should call my cell phone via Twilio Call over the Huawei. It worked by my adding the device: /ttyUSB0 line to my twilio_call configuration in the yaml file. The cost for a Twilio call is $0.013 per minute.

In short, the SMS and the Twilio Call are both being sent through my Twilio SIM.

2 Likes

I’ve been wanting to do the seem thing as a backup for my alarm system when the Internet is down. Can you provide more detailed info on your hardware and software setup? Going to re-look at doing this integration with HA again. Thanks

At the moment I’m on a Pi4-64/8gb running 64-bit Raspberry OS (2020-08-20-raspios-buster-arm64). I have hassio running in Docker. Actually, I plan to pick up a used (new to me) Win10 i5 from my computer guy, when he has it ready, for a virtual Debian environment / Docker / Hassio. I presume retracing my steps to arrive at this same point on the virtual machine will be straightforward.

@kslb: Like you, it seems that I am unable to receive incoming SMS via the E3372h. @Oscar_Calvo I did try /dev/ttyUSB0 and /dev/ttyUSB1, and both can send outgoing but neither show any Events when I am listening to sms.incoming_sms in HA. I did install sudo apt-get install libgammu-dev in my Raspberry OS CLI. However, since the SMS integration specifies that “When running Home Assistant, you need to install the SSH add-on.”, I wonder whether I am supposed to install sudo apt-get install libgammu-dev via the SSH add-on for HA? Admittedly, I am a bit confused (noob here); I am unable to execute sudo apt-get install libgammu-dev when I use Putty to SSH into HA (apparently sudo and apt-get are both unrecognized). Am I doing something incorrectly?

I’m really going to town with replies today. I think this warrants a new post, and not an edit.

After trying to get incoming SMS to work to no avail, by switching to ttyUSB1 and back, and installing sudo apt-get install libgammu-dev, I have tried to send a Twilio Call through the modem and it’s not working. I’m trying to resolve it (feel free to help a noob if you have ideas). Outgoing SMS still works fine. Just trying to get Twilio Call to work again. I uninstalled libgammu-dev and restarted, which didn’t seem to have any effect.

@Oscar_Calvo Hello, I am testing HassOS V5.5 64 bits on a Pi4B and I am trying to use SMS integration with a Huawei E3531… I can change the modem to serial modem and see 3 ttyUSB… but when I try to send SMS, I have the following error:

2020-11-25 19:58:53 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.gsm_signal_imei_8611430357XXXXX is taking over 10 seconds
2020-11-25 19:58:55 ERROR (MainThread) [homeassistant.components.sms.notify] Sending to 0484XXXXXX failed: ERR_UNKNOWN

Based on what I see on the modem, it is not connected to the SMS provider (led flashing twice every 2 seconds), but if I move this modem on another raspberry pi with Raspbian 32 bits, it is able to connect to the provider… Driver issue ? 64 bits issue ?
Do you know if this modem is working with HassOS V5.5 64 bits ? Any recommendation for a compatible modem ? Thanks !

@Oscar_Calvo I found the root cause of the problem… Power issue !.. I had to add a powered USB hub and that fixed the issue… I can now send SMS with Huawei E3531 on HassOS V5.5 64 bits (Pi4B 2GB) !

Update: SMS reception is still problematic… It worked once (for the first SMS in the inbox) but no reaction to the other SMS received… I had two other SMS going to the Inbox and intercepted by HA… I don’t know why those two… Strange …

As the SMS integration is not able to receive SMS (bug in Gammu ?), I decided to customize two python scripts using python-gsmmodem_new (version 0.12)… One to read new SMS from inbox, the other one to send SMS… Working fine sofar with a Huawei E3531 configured as serial modem (12d1:1001) on hassos V5.5 64 bit (Pi4B 2B)…

Hello, i have a Huawei key 4g (on hass.io and vmware esxi) and i want to send sms for my alarm notifications. I installed “Send SMS with USB GSM” and this in my configurations.yaml :

sms:
device: /dev/ttyUSB0

notify:

  • platform: sms
    name: Tel
    recipient: ‘06xxxxxxxx’

image

But in the tutorial he say : Set this content in file udev\10-gsm-modem.rules
I don’t find the udev folder in hass.io

And the second question is : can i configure pin code or i disable it ?

Last question : how to send sms when it works ?

@Akhethan Hello, the “10-gsm-modem.rules” file is used by storing the file on a USB key to change to status of the modem stick from storage to modem mode… I think yours is already in modem mode as a serial modem based on what I see in your post…

To send a sms, look at your services, you should use the service “notify.tel” in your case or something like that…
Than in the automation or test in the “development menu” > “services”, add the following action this should send your SMS if everything is OK (if something wrong, look at home-assistant.log for any error message related to SMS platform):

- service: notify.tel
  data:
    message: "your sms"

Regarding the pin, I disabled it…

Hi, i’m using huawei 3531, with HA in docker env.
i’ve configured the integration. I can’t recieve messages while sending works fine. There is no sms.incoming_sms event in logs. Any one could help?

1 Like

@bigsem89 Same for me with Huawei E1752

1 Like

Hi, does anyone know how to convert the modem on an Odroid? I have the N2+, running Hass os (latest version) with a Huawei E1780.

Followed the steps but not luck. Running usb_modeswitch from cli (protection mode disabled) does not work either, any idea how to /if the package can be installed on Odroid?

Hi @kslb, I think I’m following the same steps, still no luck on my side with my E3531 (usb stick with config file did not work, so I’m not able to change it to modem mode).

Could you send me the link to the french forum you visit ? (I’m french)

Thank you.

Is this support wavecom fastrack M1306B modem ? thanks

I have bought this product on AliExpress and it works perfectly with the SMS integration. Send and receive SMS without problems. I use it in Home Assistant on Docker. Only for 2G Network. 6€ :smile:

€ 2,36 5%de DESCUENTO | Módulo USB a GSM, dispositivo de cuatro bandas, GSM, GPRS, SIM800, SIM800C, para mensajería inalámbrica por Bluetooth, SMS, con antena

3 Likes

Thanks, just ordered. will try on hassio.

Hello,

I am trying to have a similar SMS notification option for various triggers for my HA setup (loss of internet connectivity , power outage etc).

Can you please inform the following:

  1. Are you using it with HA on Docker on a RPI or any other platform.

  2. I plan to have it on HASS OS image on Inter NUC . Any idea if it will work out of the box.

  3. Does it require any additional custom config (to bring it to a modem mode or something similar like it needs to be done for Huawei USB Modems for UART mode) or does it work mostly out of the box by activating the relevant module in HA.

  4. Have you considered/got any kind of power backup for the device running HA to keep having the notifications in case of power outage. Any suggestions around it.

Thanks for the response

1 Like