Send SMS with USB GSM modem when alarm triggered

Hello.

  1. HA on Docker on Intel. NUC.

  2. It works without problem.

  3. In my case. I didn’t have to set anything up. It has been plugging in, looking at the number of USB generated (/ttyUSB0) and activating SMS integration. Nothing else.

  4. As the modem is connected directly to the NUC and it is connected to a UPS. No problem with me when the light goes out.

Just remember that this gateway only works on 2G (GSM) networks.

Best regards

I’d like to have input boxes where I enter phone number and message that gets sent.
Is it possible and in that case how?
Currently I have to add a notification-configuration for every recipient. I’d like to be a bit more flexible.

Thanks.

1 Like

Hello.

I use E3372s-153, I can’t recieve SMS - sending works fine :frowning:
There is any solution for it?
I use HA on Proxmox VE

Thanks

Hello :slight_smile:

I have some tips how to E3372s-153 works for me.

On Win10 I install special drivers/firmware for Huawei (Przerobienie E3372s-153 HiLink na zwykły modem - Forum bez kabli - Internet mobilny 3G LTE 5G CDMA WIFI - in polish lang).
So, I tried to change E3372 to modem mode only (turn off NCI).

When I config:

AT^SETPORT=“FF;12,10,1,A2”

With “FF;” the E3372 is in only modem mode (I can’t change modem mode with usb_modemswitch command in SSH).

Modem send sms via HA, but not receive. On listening event sms.incoming_sms its just empty all time.

But, when I send:

AT^SETPORT=“A1;12,10,1”

My HA report only USB stick as addional USB disk. It’s not possible to integrate with HA by “sms” addon.
But, when I use usb_modeswitch:

/sbin/usb_modeswitch -X -v 12d1 -p 14fe

12d1 - vendor
14fe - model ID
This data I read from “lsusb” in ssh.

I and restart HA my model ID changed.
My config HA:

sms:
device: /dev/ttyUSB0

After this all it’s work - I can send and receive SMS :slight_smile:

This is my way to integrate HA with 3372s-153.
But when I try to turn on only modem mode with

AT^SETPORT=“FF;12,10,1,A2”
AT^SETPORT=“FF;12,10,1”

(or something else with “FF” first)

HA send SMS, but not receive… :frowning: There is a bug…

But, “usb_modemswitch” command I have to use every time, then I restart Proxmox.
How I try to use modemswitch command on config USB, but I can’t do this… someone can help me? :slight_smile:

Hello again :slight_smile:

After fight, It’s seems to work for me.

I do this:

AT^SETPORT=“A1,A2;12,10,1”

Take aby USB stick (with readable i writeable memory), format, label “CONFIG”, create in this stick folder “udev” and file “10-gsm-model.rules”. In file:

ACTION=="add" \
, ATTRS{idVendor}=="12d1" \
, ATTRS{idProduct}=="14fe" \
, RUN+="/sbin/usb_modeswitch -X -v 12d1 -p 14fe"

After this, put in HA server (HP T610 for me), in Proxmox root panel setting new USB stick to HomeAssistant. Restart Proxmox. In HA panel → Supervisior → Hardware → Import from USB. Restart Proxmox. All works :slight_smile: I can send and receive SMS even after reset :slight_smile:

Ordered one when I saw your post, just received it today. I can confirm it works very well. Just pop in a SIM card, plug it into a USB port and it exposes a standard AT command set over serial. A couple of AT commands later and I had a first SMS sent to my phone. Signal strength is pretty good with the little antenna that comes with it, although I will probably use an external one with a cable (it’s a standard SMA connector). Awesome value for the price !

I don’t have a free USB port on my Pi anymore, so I’m going to plug it into the NAS and forward HA’s notifications over MQTT instead.

Oh yeah, it needs a 2G network, so it probably won’t work in the US anymore.

1 Like

Works without issue on hassio / odroid n2+

I have problems setting the udev variables, when I import the file from the USB stick the following error appears in the log:

[15:10:38] INFO: Using udev information from host
[cont-init.d] udev.sh: exited 0.

the stick I labled CONFIG, also I tried using FAT32 and ext4. Both failed.
Also the path /etc/udev/… is not created.

Can se send à sms without defining a phone number inside à notification option?

Make sure the file is under the “udev” folder.
Also make sure the file is saved using LF (Unix style) and not CR/LF (Windows Style). Use and editor like VSCode and make sure the file is saved using Unix style.

1 Like

Great work from you guys,

I had have a problem with the read automation, as I still have to adjust it a bit to forward SMS to my phone number.

This is how it works for me:

 alias: read-sms
 trigger:
   - platform: event
     event_type: sms.incoming_sms
 action:
   - service: notify.sms_person1
     data:
       title: SMS received
       message: >
         SMS from: {{trigger.event.data.phone}};  Text:
         {{trigger.event.data.text}}
 initial_state: 'on'
 mode: single

I also use the cheap SIM800C solution as I couldn’t get the sticks to work.

Hi everyone!

I am trying to configure an E3272 Huawei Modem with Home Assistant on Raspberry Pi 4. I made the device to work only as modem, I can even see a result with

ls -l /dev/*USB*

but I see three results:

/dev/ttyUSB0
/dev/ttyUSB1
/dev/ttyUSB2

Then, I went to integrations, add the SMS integration and as for device, I tried with the 3rd line, error, then 2nd line, still error, then 1st line… still error… I see that the Home Assistant detected a new integration (the sms integration), but does not matter what I write on the device, it is not working…

When I use /dev/ttyUSB2 and /dev/ttyUSB0, I get the error in maximum 4-5 seconds, when I use /dev/ttyUSB1, I get the error in 15-20 seconds, like is tryting to do something… but still it finishes with “Failed to connect”. The device is connected to an USB 2.0 port

Any advices?

Thank you!

1 Like

reboot the OS could help, I had also met with this issue, and after reboot it became fine.

I did it but still not working… :slight_smile:

Hi

How do you that Graph for the sensor.gsm ?

Standard footer graph for the entities card.

1 Like

Can you please copy the lovelace configuration , Thanks !!!

An example is on the page I linked to - I’ve recently revamped my dashboard to a more compact format and no longer have the graph displayed.

Hello,

I red the topic, found similar situation as the one I’m facing but didn’t understand the answer.

Home Assistant is running on a Raspberry Pi4 and I try to use a Huawei E3531 Surf Stick.

I log to the Pi4 with ssh then enter

lsusb

Bus 001 Device 007: ID 12d1:1f01 ← The Huawei E3531
Bus 001 Device 006: ID 0658:0200
Bus 001 Device 001: ID 1d6b:0002
Bus 001 Device 004: ID 0bda:5411
Bus 001 Device 003: ID 13fe:4200
Bus 001 Device 002: ID 2109:3431
Bus 002 Device 002: ID 1f75:0621
Bus 002 Device 001: ID 1d6b:0003
Bus 001 Device 005: ID 0403:6015

To see it as a modem, I formatted a USB2 key to FAT32, called it CONFIG create the directory udev and inside this directory the file : 10-gsm-modem.rules where Enter are LF (did it under unix system).

ACTION==“add”
, ATTRS{idVendor}==“12d1”
, ATTRS{idProduct}==“1f01”
, RUN+="/sbin/usb_modeswitch -X -v 12d1 -p 1f01"

I plug the USB2 key and the Huawei E3531 to the Pi4 then reboot it.

Once rebboted, I connect to the Pi4 with ssh then enter

ls -l /dev/USB

crw-rw---- 1 root audio 188, 0 Jun 19 19:20 /dev/ttyUSB0
crw-rw---- 1 root audio 188, 1 Jun 19 19:23 /dev/ttyUSB1
crw-rw---- 1 root audio 188, 2 Jun 19 19:20 /dev/ttyUSB2
crw-rw---- 1 root audio 188, 3 Jun 19 19:23 /dev/ttyUSB3

I added in configuration.yaml these lines :

sms:
device: /dev/ttyUSB2

then rebooted the Home Assistant and now I see a new integration :

Capture d’écran 2021-06-19 à 19.36.17

If try configure

Capture d’écran 2021-06-19 à 19.38.51

but it fails. I also try with

/dev/ttyUSB0
/dev/ttyUSB1
/dev/ttyUSB3

it also fails…

Help is welcome

2 more things :

1/ when I enter lsusb the list is a bit different :

Bus 001 Device 008: ID 12d1:155e
Bus 001 Device 006: ID 0658:0200
Bus 001 Device 001: ID 1d6b:0002
Bus 001 Device 004: ID 0bda:5411
Bus 001 Device 003: ID 13fe:4200
Bus 001 Device 002: ID 2109:3431
Bus 002 Device 002: ID 1f75:0621
Bus 002 Device 001: ID 1d6b:0003
Bus 001 Device 005: ID 0403:6015

2/ The SIM card I received is protected with a PIN code,
do I need to remove it ?

Update: 2021/06/21

I plug the key on a computer and desactivate the pin code. Then after several reboots, Home assistant accepted the integration on /dev/ttyUSB3.

I tested it to send a message and it works.

depends on your modem and the operator.

in fact, I am using a Huawei E180, it works quite well on 3G (WCDMA) network.

if you have a 4G-modem or 5G, I don’t think there would be any problem.