Send SMS with USB GSM modem when alarm triggered

You seem to be using an old version of home-assistant, could you upgrade to the latest?

hello Oscar,
I looked at my version and it seems be to the last
can you tell me if I’m wrong ?

arch	x86_64
chassis	laptop
dev	false
docker	true
docker_version	19.03.12
hassio	true
host_os	Debian GNU/Linux 10 (buster)
installation_type	Home Assistant Supervised
os_name	Linux
os_version	4.19.0-9-amd64
python_version	3.8.3
supervisor	232
timezone	Europe/Paris
version	0.114.0
virtualenv	false

thank you

I dont understand what is requesting python-gammu==2.12
The sms integration requires python-gammu=3.1

could run pip install python-gammu=3.1

on debian, the last version seems to be 2.12-1

[buster (stable)](https://packages.debian.org/en/buster/python-gammu) (python): Python module to communicate with mobile phones (Python 2)
2.12-1: amd64 arm64 armel armhf i386 mips mips64el mipsel ppc64el s390390x

also, here is my output:
samos99@HA:/tmp# sudo pip install python-gammu==3.1
Collecting python-gammu==3.1
Could not find a version that satisfies the requirement python-gammu==3.1 (from versions: 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 2.10, 2.11, 2.12)
No matching distribution found for python-gammu==3.1

hello, I found this in the source in this file manifest.json

{
  "domain": "sms",
  "name": "SMS",
  "documentation": "https://github.com/ocalvo/ha-sms/blob/1a867ef6d6fd1722b3140dda4e1ec9a6468c8073/README.md",
  "requirements": ["python-gammu==2.12"], <<<<<< this is the source of my problem 
  "dependencies": [],
  "codeowners": ["@ocalvo"]
}

I dug down a bit further into this as I now have a use case for receiving SMS in HA.

It looks very much to me like the Huawei Modem E3531 is not supported by gammu for receiving SMS messages - based on my own tests posted above and the open issue on GitHub

I’d love to be corrected on this, as it saves me hunting down an alternative fully supported modem.

Edit: Alternatively if I’m correct on the above, suggestions for a modem that fully supports send and receive appreciated.

So after confirming my suspicions that the E3531 only supports sending SMS via gammu (regardless of which interface is selected) I was able to track down a vintage unlocked Huawei E220 to work with.

I tested with gammu from command line as root and as the homeassistant user (which is already a member of the dialout user group). This is with HA Core v0.114.4 in a Python 3.7 venv on Ubuntu 18.04.

  1. lsusb output
ID 12d1:1003 Huawei Technologies Co., Ltd. E220 HSDPA Modem / E230/E270/E870 HSDPA/HSUPA` Modem
  1. mapped to /dev/sms with udev (unnecessary but my preference):
    sudo nano /etc/udev/rules.d/999-sms-gateway.rules
#symlink to Huawei USB Modem E220 - added kernel tag as udev
KERNEL=="ttyUSB1", SUBSYSTEM=="tty", ATTRS{idVendor}=="12d1", ATTRS{idProduct}== "1003", SYMLINK+="sms"
  1. restarted udev, then unplug modem and plug back in.
    sudo udevadm control --reload

  2. Configure homeassistant via UI for port /dev/sms

  3. Restart HA.

  4. Profit

Event 0 fired 13:00:
{
    "event_type": "sms.incoming_sms",
    "data": {
        "phone": "<redacted>",
        "date": "2020-08-29 13:00:21",
        "text": "Victory is mine!"
    },
    "origin": "LOCAL",
    "time_fired": "2020-08-29T12:00:25.316059+00:00",
    "context": {
        "id": "392152f8e9ef11ea8fb857b3a4c2668a",
        "parent_id": null,
        "user_id": null
    }
}
1 Like

Take a look here : https://community.jeedom.com/t/sms-huawei-e3531-sim-free-retour-dexperience/20271
Maybe we can make it work

I see that there is some info missing from the docs - like in example that there is ‘sms.incoming_sms’ event that can be used in automations… :slight_smile:
Anyway - is there any chance to add some way to have USSD or custom AT command requests?
I’d like to know values of signal (could be sensor set by integration) but also cash amount left on prepaid card I have.
Currently only way to see that is to use USSD code.

I use SIM800L via UART, works with the integration.

I really need help…

I have Raspberry Pi 4, 4GB, Home Assistant Core, version 0.115.3.

Device is:

  • Huawei E3531
    (inserted SIM card, mobile data disabled as I need only SMS sending feature)
  • 16GB USB stick for configuration

I’m strugling for 2 days to detect device with no success…

I tried with file content (udev\10-gsm-modem.rules):

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

and also with

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

and also withouth -x prefix…

I did make USB import in “http://MYIP:8123/hassio/system” under “Import from USB”.

But I see error under udev:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] udev.sh: executing... 
[14:08:15] INFO: Update udev information
[cont-init.d] udev.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[14:08:16] INFO: Start local supervisor watchdog...

Probably this is meaning that something is not OK. Error is the same in both script which I tried under file “10-gsm-modem.rules”.
So, did I make some mistake?

Also, when I log via PuTTY [terminal window] (where I got vendor ID, product ID) it do not find any USB device, no matter how much time I make restart of Home Assistant Core or Host system…

~ $ lsusb
Bus 001 Device 001: ID 1d6b:0002
Bus 001 Device 003: ID 12d1:1f01
Bus 001 Device 002: ID 2109:3431
Bus 002 Device 002: ID 0781:5583
Bus 002 Device 001: ID 1d6b:0003
~ $ ls -l /dev/*USB*
ls: /dev/*USB*: No such file or directory
~ $

So, is this problem regarding that I did not make step:
Try disable virtual cd-rom and change work mode “only modem”. After this modem correct work on Raspberry Pi without ‘udev’ rule.

If yes, how exactly to do that?

Also, I did not convert USB Huawei E3531 to modem-mode function as I do not know how to do that.
I know that there is instruction for Huawei E3372h-153 on http://blog.asiantuntijakaveri.fi/2015/07/convert-huawei-e3372h-153-from.html, but is this also good for my device, because it’s not the exact same device?

Can somebody help me step by step what I need to do so that I will resolve and make possible to send SMS via HA.

THANK YOU for your help…

You should have a signal sensor already, named in the format sensor.gsm_signal_imei_nnnnnnn where nnnnnnn is your IMEI number

I’ve found it, indeed - it was not documented tho, neither is connected with integration in UI. :slight_smile:
But still, issuing USSD would let me have it self-running with notification regarding no more cash on prepaid card. :slight_smile:

Yesterday I succesfully change Huawei E3531 to modem mode.
But still I have no success on detecting USB device.

New device ID is now 1446 (before was 1f01).

So, do I need to use 1446 or as before 1f01 in USB configuration script.

Thank you for answer.

PS: Which script should I use.

Also… what I need to write under entities integration for SMS for device window?
Or SMS integration should be detected automaticly?

And - should I use extra USB key for configuration or could I use microSD card in USB modem stick?

Hi

Sorry if hijacking this thread a bit.
I have been trying to install the SMS integration into my Home Assistant setup without luck.
I have a WaveCom GSM modem, which accepts AT commands via Serial interface. It works like a charm with gammu.

When trying to add the integration, I type in the /dev/ttyUSB0 for the modem, but it says “Failed to connect”
image

Looking under the supervisor page I can see it in the hardware list:
(Snippet from the list) Don’t know what the arrow below ttyACM0 indicates though…
image

I have been trying to find logs, that states something - but without luck.
I am running the system from Docker - and doing an lsusb inside with the SSH addon, I can also see the device. It is belonging to the same groups as my ConBee II, and that works fine.
image

I have tried restarting the home assistant - and the virtual machine running home assistant. Still without luck. I would really like to run this integration instead of some homemade gammu-smsd.

EDIT:
I just tried to do it again - still get an error - the same as before. I looked in the logs, and the following is showing:
2020-09-27 14:59:33 ERROR (MainThread) [homeassistant.components.sms.gateway] Failed to initialize, error ERR_DEVICEOPENERROR

Can’t really figure out where to go from here. Looking at the permissions, they are the same as for the ConBee II, which works just fine.

Oh yeay, and running Core 0.115.2 with supervisor 245 - all is running as a docker:


an this is running on a Virtual Machine on a Intel NUC running ESXi. I have installed Gammu on the virtual machine running the docker, and connected to the modem without any issues - sending and receiving messages.

Really hope, that somebody here can help me out.

I did everything as seen on instructions (https://markus.relix.de/index.php/Set_Huawei_E3372h_from_hilink_to_stick_mode)… Huawei E3372h-153 still not working…

Can anybody help me…

Can you disconnect the modem, reboot, list the devices.

Then connect the modem, reboot, list devices again.

Is there a difference in the listed devices?

I succedded via French forum + google translate :slight_smile:

slika

slika

Now question is how to add SMS function, so that I could send SMS… Receiving is not so important, just to send it… Because I do not get any sensor or something for that…

Sorry, a bit tired… I set it, so also SMS is sending as should…

Only one function is missing, maybe you can fix it… special letters: ČĆŽĐŠ čćžđš become CCZDS cczds

Thank you…

Finally got around to trying this out… I am running on Intel NUC, HassOS 4.13, Home Assistant 0.115.5

I have a conbee and a zwave diongle already installed.
image

I have tried with:

sms:
  device: /dev/ttyS0

and

sms:
  device: /dev/ttyUSB0

Both of which invoke the configuration of the component via integrations (having discovered devices)

However, when I try and complete the integration, I can type either permutation or combination of /dev/ttyS0 or /dev/ttyUSB0 i get

image

Could you help?

Many thanks for all your work on this, it has come on massivly… Nice work!