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
/dev/serial/by-id/usb-1a86_USB_Serial-if00-port0
as suggested, however, not able to work :frowning:
I’m getting error ‘Failed to connect’
image

image

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 sendSms.sh
#!/bin/bash
DEST=$1
MD="/dev/ttyUSB0"
message="$2"
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]$ ./sendSms.sh 123 "EXAMPLE"
Sending EXAMPLE to 123
stty: can't open '/dev/ttyUSB0': Resource busy
./sendSms.sh: line 18: /dev/ttyUSB0: Resource busy
./sendSms.sh: line 19: /dev/ttyUSB0: Resource busy
./sendSms.sh: line 20: /dev/ttyUSB0: Resource busy

lsof doesn’t show any usage

[core-ssh config]$ lsof /dev/ttyUSB0
1       /package/admin/s6-2.11.2.0/command/s6-svscan    0       /dev/null
1       /package/admin/s6-2.11.2.0/command/s6-svscan    1       pipe:[18601]
1       /package/admin/s6-2.11.2.0/command/s6-svscan    2       pipe:[18602]
1       /package/admin/s6-2.11.2.0/command/s6-svscan    3       /run/service/.s6-svscan/lock
1       /package/admin/s6-2.11.2.0/command/s6-svscan    5       /run/service/.s6-svscan/control
1       /package/admin/s6-2.11.2.0/command/s6-svscan    6       /run/service/.s6-svscan/control
1       /package/admin/s6-2.11.2.0/command/s6-svscan    7       anon_inode:[signalfd]
15      /package/admin/s6-2.11.2.0/command/s6-supervise 0       /dev/null
15      /package/admin/s6-2.11.2.0/command/s6-supervise 1       pipe:[18601]
15      /package/admin/s6-2.11.2.0/command/s6-supervise 2       pipe:[18602]
15      /package/admin/s6-2.11.2.0/command/s6-supervise 3       /run/service/s6-linux-init-shutdownd/supervise/lock
15      /package/admin/s6-2.11.2.0/command/s6-supervise 4       /run/service/s6-linux-init-shutdownd/supervise/control
15      /package/admin/s6-2.11.2.0/command/s6-supervise 5       /run/service/s6-linux-init-shutdownd/supervise/control
15      /package/admin/s6-2.11.2.0/command/s6-supervise 6       anon_inode:[signalfd]
18      /package/admin/s6-linux-init-1.0.8.1/command/s6-linux-init-shutdownd    0       /dev/null
18      /package/admin/s6-linux-init-1.0.8.1/command/s6-linux-init-shutdownd    1       pipe:[18601]
18      /package/admin/s6-linux-init-1.0.8.1/command/s6-linux-init-shutdownd    2       pipe:[18602]
18      /package/admin/s6-linux-init-1.0.8.1/command/s6-linux-init-shutdownd    3       /run/service/s6-linux-init-shutdownd/fifo
18      /package/admin/s6-linux-init-1.0.8.1/command/s6-linux-init-shutdownd    4       /run/service/s6-linux-init-shutdownd/fifo
24      /package/admin/s6-2.11.2.0/command/s6-supervise 0       /dev/null
24      /package/admin/s6-2.11.2.0/command/s6-supervise 1       pipe:[18601]
24      /package/admin/s6-2.11.2.0/command/s6-supervise 2       pipe:[18602]
24      /package/admin/s6-2.11.2.0/command/s6-supervise 3       /run/s6-rc:s6-rc-init:hdpMkL/servicedirs/s6rc-fdholder/supervise/lock
24      /package/admin/s6-2.11.2.0/command/s6-supervise 4       /run/s6-rc:s6-rc-init:hdpMkL/servicedirs/s6rc-fdholder/supervise/control
24      /package/admin/s6-2.11.2.0/command/s6-supervise 5       /run/s6-rc:s6-rc-init:hdpMkL/servicedirs/s6rc-fdholder/supervise/control
24      /package/admin/s6-2.11.2.0/command/s6-supervise 6       anon_inode:[signalfd]
25      /package/admin/s6-2.11.2.0/command/s6-supervise 0       /dev/null
25      /package/admin/s6-2.11.2.0/command/s6-supervise 1       pipe:[18601]
25      /package/admin/s6-2.11.2.0/command/s6-supervise 2       pipe:[18602]
25      /package/admin/s6-2.11.2.0/command/s6-supervise 3       /run/s6-rc:s6-rc-init:hdpMkL/servicedirs/s6rc-oneshot-runner/supervise/lock
25      /package/admin/s6-2.11.2.0/command/s6-supervise 4       /run/s6-rc:s6-rc-init:hdpMkL/servicedirs/s6rc-oneshot-runner/supervise/control
25      /package/admin/s6-2.11.2.0/command/s6-supervise 5       /run/s6-rc:s6-rc-init:hdpMkL/servicedirs/s6rc-oneshot-runner/supervise/control
25      /package/admin/s6-2.11.2.0/command/s6-supervise 6       anon_inode:[signalfd]
33      /package/admin/s6-2.11.2.0/command/s6-ipcserverd        0       socket:[19695]
33      /package/admin/s6-2.11.2.0/command/s6-ipcserverd        2       pipe:[18601]
33      /package/admin/s6-2.11.2.0/command/s6-ipcserverd        3       anon_inode:[signalfd]
142     /package/admin/s6-2.11.2.0/command/s6-supervise 0       /dev/null
142     /package/admin/s6-2.11.2.0/command/s6-supervise 1       pipe:[18601]
142     /package/admin/s6-2.11.2.0/command/s6-supervise 2       pipe:[18602]
142     /package/admin/s6-2.11.2.0/command/s6-supervise 3       /run/s6/legacy-services/sshd/supervise/lock
142     /package/admin/s6-2.11.2.0/command/s6-supervise 4       /run/s6/legacy-services/sshd/supervise/control
142     /package/admin/s6-2.11.2.0/command/s6-supervise 5       /run/s6/legacy-services/sshd/supervise/control
142     /package/admin/s6-2.11.2.0/command/s6-supervise 6       anon_inode:[signalfd]
143     /package/admin/s6-2.11.2.0/command/s6-supervise 0       /dev/null
143     /package/admin/s6-2.11.2.0/command/s6-supervise 1       pipe:[18601]
143     /package/admin/s6-2.11.2.0/command/s6-supervise 2       pipe:[18602]
143     /package/admin/s6-2.11.2.0/command/s6-supervise 3       /run/s6/legacy-services/ttyd/supervise/lock
143     /package/admin/s6-2.11.2.0/command/s6-supervise 4       /run/s6/legacy-services/ttyd/supervise/control
143     /package/admin/s6-2.11.2.0/command/s6-supervise 5       /run/s6/legacy-services/ttyd/supervise/control
143     /package/admin/s6-2.11.2.0/command/s6-supervise 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
image

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/gateway.py:209
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

Hi

I want to show incomming SMS

event_type: sms.incoming_sms

on my desktop with

browser_mod.popup

somewhere arround this…

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

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

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
trigger:
  - platform: event
    event_type: sms.incoming_sms
action:
  - service: mqtt.publish
    data:
      topic: "sms2mqtt/incoming_sms"
      payload_template: "{{trigger.event.data.text}}"
      qos: "2"
  - service: browser_mod.popup
    data:
      dismissable: true
      title: Incoming SMS
      content: "{{trigger.event.data.text}}"

My automation goes like this

alias: Automation_Fwd_incoming_SMS_to_Telegeram
description: ""
trigger:
  - platform: event
    event_type: sms.incoming_sms
condition: []
action:
  - service: notify.telegram_group_smsindia
    data:
      title: "{{trigger.event.data.text}}"
      message: |
        _[{{trigger.event.data.phone}}]_
        _[{{trigger.event.data.date}}]_
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?

AT^SETPORT=?
^SETPORT:2: 3G PCUI
^SETPORT:3: 3G DIAG
^SETPORT:5: 3G GPS
^SETPORT:A: BLUE TOOTH
^SETPORT:16: NCM
^SETPORT:A1: CDROM
^SETPORT:A2: SD
^SETPORT:A3: RNDIS
^SETPORT:12: 4G PCUI
^SETPORT:13: 4G DIAG
^SETPORT:14: 4G GPS

This is the configuration:
AT^SETPORT?
^SETPORT:FF;13,12,A2,16

Hi,
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.

Hi,

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.
AT+CPMS="SM","SM"
+CPMS: 0,20,0,20,0,20
OK
AT+GMM
MC55i
OK
AT+GMI
SIEMENS
OK

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?