Send SMS with USB GSM modem when alarm triggered

Huawei E3531 Surf Stick (HSPA +, USB, HSUPA, Edge/GPRS)
It works nice with domoticz and gammu

I will try to see logs via ssh. (hassio don’t start when I add config in configuration.yaml)

Install the sshd add on.
Type lsusb

You may need to configure run usb mode switch manually
Follow the instructions for raspberry pi on https://www.home-assistant.io/integrations/sms

Ok thanks a lot Oscar :slight_smile: I will do that as soon as possible, and I post the result.

When running lsusb you need to obtain the brand ID for Huawei and the model ID and create a config file for a USB config stick and reboot Hassos.

bus 001 device 005: ID 12d1:15ca.
for huawei stick.
I create the file in udev like for raspberry 4? No I think not…
“create a config file for a USB config” how I do that…

NOTE ABOUT Huawei and certain devices like RPI

You need to create udev rule in a configuration USB stick for the some Huawei sticks to be recognized.
Run lsusb, its output looks like this:

bus 000 device 001: ID 1FFF:342a
bus 001 device 005: ID 12d1:15ca   <-------- Huawei is usally 12d1
bus 000 device 002: ID 2354:5352
bus 000 device 002: ID 1232:15ca

Identify the brand for your GSM modem, copy the brand_Id and product_id (In this case brand_id = 12d1 and product_Id = 15ca)

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)

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

Here is a sample configuration file:

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

Plug the USB stick, reboot the device, run lsusb again.
The resulting product id now should be different and the brand id should be the same.
And ls -l /dev/*USB* should now report your device.

If the device is still not recognized, remove the parameter -X from the usb_modesiwtch command and reboot again.

DID IT !! thanks a lot Oscar, and sorry to be such a noob… I begin home assistant with gammu

Hi, trying to setup the new integration, I get this error :
{'Text': 'No SMSC number given. Provide it manually or use the one configured on the phone.', 'Where': 'SendSMS', 'Code': 31}
This is because the PIN is missing I think, is it possible to add it in the YAML config ?

Thanks

Pin is not supported at this time, but adding support for it should not be hard.

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?