Send SMS with USB GSM modem when alarm triggered

I thought I removed the PIN in the past so the SIM would not ask for it, but it’s true gammu asked for it from time to time on the Debian I had set it up on…

Hi All,

And do you know if receiving sms will also be supported?

Thanks

Eventually, but I don’t have time at the moment.

1 Like

Dear All

I tried to follow your instructions but i don’t understand where i have to put the config file…

Set this content in file udev\10-gsm-modem.rules in the configuration USB:
(Replace brand_Id and product_id for the numbers reported by lsusb)

  • Do i need a seperate usb stick?
  • Do i have to add this config file on the gsm stick (Huawei E3531)
  • Or Do i have to add this config file on the raspberry pi? - If yes which folder?
    (I cant find the folder udev on my hassio. And if i create it, it is deleted after reboot)

My config file looks like this:

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

Thank you very much for your help.

1 Like

Hi Fabian,
Yes you need a separate usb stick with your config files. To declare GSM stick, WiFi configuration etc…

After, you only need to configure y’all

Take care,
Dornata

Hello,

Thanks for this plugnin work well in E3531i-2 --> Xpenology 6.2 --> Docker --> Hass.io
But i’m try to extend max characters in message.
Have you an advice?

Regards.

Thanks

If you mean that long sms messages are getting cut off, this has already been fixed 2 days ago, please wait for the next beta release.

Thanks for your reply.

@dornata - Thank you very much for your hint - i think it is working now…

Next issue i am dealing with, when i send a message:

Sending to 444 failed: {‘Text’: ‘Failed to get SMSC number from phone.’, ‘Where’: ‘SendSMS’, ‘Code’: 69}

Any idea what could be wrong?

I am also not sure which device i have to specify on the configuration.yaml
The list of the usb devices looks like this, how do I know which one is the correct gsm huawei stick?

ls -l /dev/*USB*
crw-rw----    1 root     audio     188,   0 Apr 21 08:21 /dev/ttyUSB0
crw-rw----    1 root     audio     188,   1 Apr 21 08:21 /dev/ttyUSB1
crw-rw----    1 root     audio     188,   2 Apr 21 08:21 /dev/ttyUSB2

I assume it is USB2 but I am not sure how to validate this:

sms:
  device: /dev/ttyUSB2

Sorry for asking such basic questions…
Thank you very much for your help.

Hello,

I have the same issue, but just two USB
image
my device is Huawei E367

When I write in my configuration.yaml
sms:
device: /dev/ttyUSB0
issue -> Invalid Config "The following integrations and platforms could not be set up:

  • sms
    Please check your config."

And when I write:
sms:
device: /dev/ttyUSB1
issue -> My home assitant not reboot. I need edit my configuration.yaml in ssh

Do you have idea ?

Thank’s

This sounds like a problem with the specific service provider. Do you have credit in your account?
Could you pop the SIM in another phone and see if you can send messages?

Also, do you have any other USB devices plugged in?

@myca5a If you remove the Huawei, reboot and then ls -l /dev/*USB* what do you get?

Hello @Oscar_Calvo

After reboot of hassio : ls -l /dev/USB --> No such file or directory

After reboot Home assistant --> I see again (without connect my device)
"crw-rw---- 1 root audio 188, 0 Apr 22 08:06 ttyUSB0
crw-rw---- 1 root audio 188, 1 Apr 22 08:06 ttyUSB1
"
But not working when I connect it.

For information
dmesg :

[ 1699.039145] usb 1-1.2: new high-speed USB device number 7 using dwc_otg
[ 1699.171559] usb 1-1.2: New USB device found, idVendor=12d1, idProduct=1506, bcdDevice= 0.00
[ 1699.178003] usb 1-1.2: New USB device strings: Mfr=3, Product=2, SerialNumber=0
[ 1699.181355] usb 1-1.2: Product: HUAWEI Mobile
[ 1699.184586] usb 1-1.2: Manufacturer: Huawei Technologies
[ 1699.207042] qmi_wwan 1-1.2:1.0: cdc-wdm0: USB WDM device
[ 1699.210536] qmi_wwan 1-1.2:1.0 wwan0: register 'qmi_wwan' at usb-3f980000.usb-1.2, WWAN/QMI device, 22:e2:27:42:a1:27
[ 1699.217964] option 1-1.2:1.1: GSM modem (1-port) converter detected
[ 1699.222007] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB0
[ 1699.226132] option 1-1.2:1.2: GSM modem (1-port) converter detected
[ 1699.230061] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB1
[ 1699.232279] usb-storage 1-1.2:1.3: USB Mass Storage device detected
[ 1699.234237] scsi host0: usb-storage 1-1.2:1.3
[ 1700.250753] scsi 0:0:0:0: Direct-Access     HUAWEI   TF CARD Storage       PQ: 0 ANSI: 2
[ 1700.268778] sd 0:0:0:0: [sda] Attached SCSI removable disk
[ 1700.281012] udevd[428]: inotify_add_watch(7, /dev/sda, 10) failed: No such file or directory
[ 1700.644425] udevd[426]: inotify_add_watch(7, /dev/sda, 10) failed: No such file or directory

Thank you very much

Are you running in hassio?

Did you configure the USB stick with a new udev rule?
Could you share that config?

Could also check to see if there is another error logged in your home assistant log file?

Any other USB devices connected?

Are you running in hassio?
Yes

Did you configure the USB stick with a new udev rule?
Could you share that config?

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

Could also check to see if there is another error logged in your home assistant log file?

Setup failed for sms: Integration failed to initialize.
8:43:45 AM – setup.py (ERROR)
Failed to initialize, error {'Text': 'Can not access SIM card.', 'Where': 'Init', 'Code': 49}
8:43:44 AM – sms (ERROR)

However my SIM working and I have deleted PIN

Any other USB devices connected?
Yes, Z-Wave Plus Z-Stick GEN5

  1. Make sure that your SIM card is active (test seing SMS from another phone)
  2. Make sure the SIM card is properly inserted in the modem.

@Oscar_Calvo

No, the problem is not related to the sim card (I cand send sms from my mobile phone using this sim card…)

After some try an and error i found out that:
The huawei stick with the sim card canot register on the gsm network (when pluged in to the rpi)
When i plug the huawei stick with the sim card to a notebook - it can connect

I can say that beacause of the led’s on the huawei stick (steady blue on the notebook)

This could also be a poor signal issue.
Are your laptop and RPI in the same physical location?

BTW: I have a new change coming to add a GSM signal sensor to the integration to help in these kind of situations.

exactly ! my sim was upside down :sweat_smile:
Now, none error in log but the services not working
Spectacle.M20366

my config :

sms:
  device: /dev/ttyUSB1

notify:
  - platform: sms
    name: sms_test
    recipient: (my number with the prefix number of the country)

Can you paste the error code displayed in the logs?