Send SMS with USB GSM modem when alarm triggered

No, I don’t think this one will work.

I’m trying to setup my SIM800C on RPi4. Its inserted into USB
Here is my terminal output.

I started the Integration, then in the Device I put
as suggested, however, not able to work :frowning:
I’m getting error ‘Failed to connect’


Any help please

1 Like

facing the same issue as ausfas using SIM800C

[core-ssh config]$ ls -lsah /dev/ttyUSB0
     0 crw-rw----    1 root     audio     188,   0 May 15 19:52 /dev/ttyUSB0
[core-ssh config]$ ls -lsah /dev/serial/by-id/usb-*
     0 lrwxrwxrwx    1 root     root          13 May 15 19:36 /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0 -> ../../ttyUSB0
     0 lrwxrwxrwx    1 root     root          13 May 15 19:36 /dev/serial/by-id/usb-ITEAD_SONOFF_Zigbee_3.0_USB_Dongle_Plus_V2_20221201211523-if00 -> ../../ttyACM0
2023-05-15 19:42:51.579 ERROR (MainThread) [homeassistant.components.sms.gateway] Failed to initialize, error ERR_DEVICEOPENERROR
2023-05-15 19:43:06.680 ERROR (MainThread) [homeassistant.components.sms.gateway] Failed to initialize, error ERR_DEVICEOPENERROR

i also tried so send a msg by commandline but looks like device is busy

[core-ssh config]$ cat
echo "Sending $message to $DEST"
stty -F $MD 9600 min 100 time 2 -hupcl brkint ignpar -opost -onlcr -isig -icanon -echo
chat TIMEOUT 10 "" "AT+CMGF=1" "OK" > $MD < $MD
chat TIMEOUT 10 "" "AT+CMGS=\"$DEST\"" "OK" > $MD < $MD
chat TIMEOUT 10 "" "$message^Z" "OK" > $MD < $MD

[core-ssh config]$ ./ 123 "EXAMPLE"
Sending EXAMPLE to 123
stty: can't open '/dev/ttyUSB0': Resource busy
./ line 18: /dev/ttyUSB0: Resource busy
./ line 19: /dev/ttyUSB0: Resource busy
./ line 20: /dev/ttyUSB0: Resource busy

lsof doesn’t show any usage

[core-ssh config]$ lsof /dev/ttyUSB0
1       /package/admin/s6-    0       /dev/null
1       /package/admin/s6-    1       pipe:[18601]
1       /package/admin/s6-    2       pipe:[18602]
1       /package/admin/s6-    3       /run/service/.s6-svscan/lock
1       /package/admin/s6-    5       /run/service/.s6-svscan/control
1       /package/admin/s6-    6       /run/service/.s6-svscan/control
1       /package/admin/s6-    7       anon_inode:[signalfd]
15      /package/admin/s6- 0       /dev/null
15      /package/admin/s6- 1       pipe:[18601]
15      /package/admin/s6- 2       pipe:[18602]
15      /package/admin/s6- 3       /run/service/s6-linux-init-shutdownd/supervise/lock
15      /package/admin/s6- 4       /run/service/s6-linux-init-shutdownd/supervise/control
15      /package/admin/s6- 5       /run/service/s6-linux-init-shutdownd/supervise/control
15      /package/admin/s6- 6       anon_inode:[signalfd]
18      /package/admin/s6-linux-init-    0       /dev/null
18      /package/admin/s6-linux-init-    1       pipe:[18601]
18      /package/admin/s6-linux-init-    2       pipe:[18602]
18      /package/admin/s6-linux-init-    3       /run/service/s6-linux-init-shutdownd/fifo
18      /package/admin/s6-linux-init-    4       /run/service/s6-linux-init-shutdownd/fifo
24      /package/admin/s6- 0       /dev/null
24      /package/admin/s6- 1       pipe:[18601]
24      /package/admin/s6- 2       pipe:[18602]
24      /package/admin/s6- 3       /run/s6-rc:s6-rc-init:hdpMkL/servicedirs/s6rc-fdholder/supervise/lock
24      /package/admin/s6- 4       /run/s6-rc:s6-rc-init:hdpMkL/servicedirs/s6rc-fdholder/supervise/control
24      /package/admin/s6- 5       /run/s6-rc:s6-rc-init:hdpMkL/servicedirs/s6rc-fdholder/supervise/control
24      /package/admin/s6- 6       anon_inode:[signalfd]
25      /package/admin/s6- 0       /dev/null
25      /package/admin/s6- 1       pipe:[18601]
25      /package/admin/s6- 2       pipe:[18602]
25      /package/admin/s6- 3       /run/s6-rc:s6-rc-init:hdpMkL/servicedirs/s6rc-oneshot-runner/supervise/lock
25      /package/admin/s6- 4       /run/s6-rc:s6-rc-init:hdpMkL/servicedirs/s6rc-oneshot-runner/supervise/control
25      /package/admin/s6- 5       /run/s6-rc:s6-rc-init:hdpMkL/servicedirs/s6rc-oneshot-runner/supervise/control
25      /package/admin/s6- 6       anon_inode:[signalfd]
33      /package/admin/s6-        0       socket:[19695]
33      /package/admin/s6-        2       pipe:[18601]
33      /package/admin/s6-        3       anon_inode:[signalfd]
142     /package/admin/s6- 0       /dev/null
142     /package/admin/s6- 1       pipe:[18601]
142     /package/admin/s6- 2       pipe:[18602]
142     /package/admin/s6- 3       /run/s6/legacy-services/sshd/supervise/lock
142     /package/admin/s6- 4       /run/s6/legacy-services/sshd/supervise/control
142     /package/admin/s6- 5       /run/s6/legacy-services/sshd/supervise/control
142     /package/admin/s6- 6       anon_inode:[signalfd]
143     /package/admin/s6- 0       /dev/null
143     /package/admin/s6- 1       pipe:[18601]
143     /package/admin/s6- 2       pipe:[18602]
143     /package/admin/s6- 3       /run/s6/legacy-services/ttyd/supervise/lock
143     /package/admin/s6- 4       /run/s6/legacy-services/ttyd/supervise/control
143     /package/admin/s6- 5       /run/s6/legacy-services/ttyd/supervise/control
143     /package/admin/s6- 6       anon_inode:[signalfd]
145     /usr/bin/ttyd   0       /dev/null
145     /usr/bin/ttyd   1       pipe:[18601]
145     /usr/bin/ttyd   2       pipe:[18602]
145     /usr/bin/ttyd   3       anon_inode:[eventpoll]
145     /usr/bin/ttyd   4       pipe:[19894]
145     /usr/bin/ttyd   5       pipe:[19894]
145     /usr/bin/ttyd   6       pipe:[19895]
145     /usr/bin/ttyd   7       pipe:[19895]
145     /usr/bin/ttyd   8       anon_inode:[eventfd]
145     /usr/bin/ttyd   9       /dev/urandom
145     /usr/bin/ttyd   10      anon_inode:[eventfd]
145     /usr/bin/ttyd   11      socket:[18896]
145     /usr/bin/ttyd   12      socket:[18897]
145     /usr/bin/ttyd   13      socket:[29223]
145     /usr/bin/ttyd   14      /dev/ptmx
145     /usr/bin/ttyd   15      /dev/null
145     /usr/bin/ttyd   16      /dev/ptmx
145     /usr/bin/ttyd   17      /dev/ptmx
155     /usr/sbin/sshd  0       /dev/null
155     /usr/sbin/sshd  1       pipe:[18601]
155     /usr/sbin/sshd  2       pipe:[18602]
155     /usr/sbin/sshd  3       socket:[19951]
155     /usr/sbin/sshd  4       socket:[19952]
185     /usr/bin/tmux   0       /dev/null
185     /usr/bin/tmux   1       /dev/null
185     /usr/bin/tmux   2       /dev/null
185     /usr/bin/tmux   3       pipe:[21175]
185     /usr/bin/tmux   4       pipe:[21175]
185     /usr/bin/tmux   5       socket:[29769]
185     /usr/bin/tmux   6       socket:[21176]
185     /usr/bin/tmux   7       /dev/pts/2
185     /usr/bin/tmux   8       /dev/ptmx
186     /bin/bash       0       /dev/pts/1
186     /bin/bash       1       /dev/pts/1
186     /bin/bash       2       /dev/pts/1
186     /bin/bash       255     /dev/pts/1
191     /usr/sbin/sshd  0       /dev/null
191     /usr/sbin/sshd  1       /dev/null
191     /usr/sbin/sshd  2       pipe:[18602]
191     /usr/sbin/sshd  3       /dev/ptmx
191     /usr/sbin/sshd  4       socket:[21211]
191     /usr/sbin/sshd  6       socket:[21227]
191     /usr/sbin/sshd  7       /dev/ptmx
191     /usr/sbin/sshd  8       /dev/ptmx
193     /bin/bash       0       /dev/pts/0
193     /bin/bash       1       /dev/pts/0
193     /bin/bash       2       /dev/pts/0
193     /bin/bash       255     /dev/pts/0
239     /usr/bin/tmux   0       /dev/pts/2
239     /usr/bin/tmux   1       /dev/pts/2
239     /usr/bin/tmux   2       /dev/pts/2
239     /usr/bin/tmux   3       pipe:[29767]
239     /usr/bin/tmux   4       pipe:[29767]
239     /usr/bin/tmux   5       socket:[29768]

maybe also helful:

Thanks it was the same issue --the Sim card direction.
Integration is picking it up, however not registering

Don’t buy SIM800C (for Australia) it’s only for 2G, even 3G will be shut down later this year.
What a waste. … Someone should have mentioned it on the SMS integration page

I’m too facing this issue
After rebooting HAOS 10 I get past this step.

but then first got a security issue, (I was to slow for the screenshot)
and then the error turns into this

so however after a reboot I’m able to install the integration it still won’t work.

I got this from the log

Logger: homeassistant.components.sms.gateway
Source: components/sms/
Integration: SMS notifications via GSM-modem (documentation, issues)
First occurred: 21:15:01 (5 occurrences)
Last logged: 21:17:32

Failed to initialize, error ERR_DEVICEOPENERROR

I’m using this verion

Home Assistant 2023.5.3 
Supervisor 2023.04.1 
Operating System 10.1 
Frontend 20230503.3 - latest 

My guess actually would be that HA needs some additional permissions to access USB, however, this is not needed for zigbee.

Can someone please point me in the right direction?

[Edit]: found the issue after reading more through this port
Pin-code was still activated, even if it is 0000 it’s activated. So I used an old phone to deactivate this.

How did you make the device work as a modem only. Noting that despite connecting keyboard I cannot run sudo command on HA

Do you know a modem that would work with HA and 4G network ?

1 Like

For about morethan 9 months, this integration was working fine for me.
Last 3 months, I han’t used it, even the USB modem was umplugged. Today I try to use it again and it doesn’t work anymore.
I tried with different device settings, either I get error failed to connect or after installing I get error “Failed setup, will retry”.

Any one faced and solved this issue, please help

Home Assistant 2023.7.3
Supervisor 2023.07.1
Operating System 10.3
Frontend 20230705.1 - latest


I want to show incomming SMS

event_type: sms.incoming_sms

on my desktop with


somewhere arround this…

alias: Forward SMS
  - platform: event
    event_type: sms.incoming_sms
  - service: browser_mod.popup
      dismissable: true
      autoclose: false
      title: test incomming SMS
      content: []

Any help from you guys which query is working for this, are welcome, thanks!

For now, incoming SMS was received by HA…
So how can i show text message in browser_mod.popup?

By try and error found this solution, works so for me…

alias: Forward SMS
  - platform: event
    event_type: sms.incoming_sms
  - service: mqtt.publish
      topic: "sms2mqtt/incoming_sms"
      payload_template: "{{}}"
      qos: "2"
  - service: browser_mod.popup
      dismissable: true
      title: Incoming SMS
      content: "{{}}"

My automation goes like this

alias: Automation_Fwd_incoming_SMS_to_Telegeram
description: ""
  - platform: event
    event_type: sms.incoming_sms
condition: []
  - service: notify.telegram_group_smsindia
      title: "{{}}"
      message: |
mode: single

I had this exact issue with this exact model, and for me this was due to a host to Home Assistant VM USB passthrough using a UHCI controller which is USB 1.1. Switching to an EHCI controller solved it :blush:

BTW for everybody here: the Huawei E3273 is a great and cheap 4G modem!
You may need to reprogram from HiLink to TTY

how did you change it? I have an Nuc12 and when I try to send an SMS the network connection is lost forever and SMS was not sent :frowning:

I started using this last month, and I really like the idea of this integration and sending SMS from a modem that is not dependent on an internet connection. I purchased a Sim7070G which hopefully will keep working after the 2G phaseout. Its working but its been generating a lot of log errors for me, and occasionally, the device doesn’t send the SMS message at all:

I’m running Home Assistant container on a Dell Optiplex running Ubuntu. The GSM modem is connected to Home Assistant by specifying the device flag in the docker run command. It connects and works (most of the time), but does anyone have any ideas on how to make it more stable? I’m wondering if something on the host Ubuntu OS is trying to use the modem and causing a conflict or issues.

Hi, i have the same problem and i have tried with your solution but when use AT^SETPORT don’t see 3G MODEM or 4G MODEM. Can u help me?


This is the configuration:

I’m not an expert but think you need to setup the device to MODEM mode first before the HA integration can use it.
If AT^SETPORT? is not reporting any modem mode available I’d try to find another firmware version for your device.


I have a problem connecting a gsm gateway (seems to be a Siemens MC55i inside) via rs232 to usb cable to ha yelow.
I can send and receive AT commands to/from /dev/ttyUSB0 in the terminal without problem, e.g.

➜  femtocom git:(master) ✗ ./femtocom /dev/ttyUSB0 115200
Connecting to /dev/ttyUSB0. Press Ctrl+Q to exit.
+CPMS: 0,20,0,20,0,20

But, when I try to setup the SMS integration (device=/dev/ttyUSB0, baud speed=115200) I get “Failed to connect” message in the “Connect to the modem” dialog, with this in log:

2024-01-12 18:16:46.641 ERROR (MainThread) [homeassistant.components.sms.gateway] Failed to initialize, error ERR_DEVICEOPENERROR

lsof does not show any use of /dev/ttyUSB0

Anyone has any ideas?

I have a question.
do SMS text messages get saved on the SIMcard? and if yes what happens when the SIM card gets full?